How to configure the environment for PHP and Apache in Windows 7

Source: Internet
Author: User
Tags php session php file upload

Introduction: This is a detailed page on how to configure the PHP and Apache environments in Windows 7. It introduces PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 330431 'rolling = 'no'>

Step 4: configure the PHP environment in Windows 7.

The configuration of the PHP environment on Windows 7 is much simpler than that on Windows XP, and does not need to be copied. rename the ini-development configuration file to PhP. ini configuration file. Perform the following Configuration:

1. Open the php. ini configuration file and find

1
2
; On Windows:
; Extension_dir = "Ext"

Change

1
2
; On Windows:
Extension_dir = "C:/PHP/EXT"

Specifies the directory of the PHP extension package to call the corresponding DLL file.

2. Because the default PHP does not support automatic connection to MySQL, You need to enable the corresponding extended library functions, such as php_mysql.dll.

1
2
3
4
5
6
7
Extension = php_curl.dll
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mysql.dll
Extension = php_pdo_mysql.dll
Extension = php_pdo_odbc.dll
Extension = php_xmlrpc.dll

Remove the semicolon (;) before these extension.

3. Configure the PHP session Function

When using the session function, we must configure the session file storage directory on the server. Otherwise, the session cannot be used. We need to create a new read/write directory folder on Windows 7, it is recommended that this directory be independent of the Web masterProgramIn addition to the directory, I created the phpsessiontmp directory in the root directory of the d disk, and then found it in the PHP. ini configuration file.

1 ; Session. save_path = "/tmp"

Change

1 Session. save_path = "D:/phpsessiontmp"

4. How to compile the PHP file upload function when configuring the PHP file upload function?

Like session, when using the PHP file upload function, we must specify a temporary folder to complete the file upload function. Otherwise, the file upload function will fail, we still need to create a read/write directory folder on Windows 7. Here I have created the phpfileuploadtmp directory on the root directory of drive D, and then in PHP. in the ini configuration file, find

1 ; Upload_tmp_dir =

Change

1 Upload_tmp_dir = "D:/phpfileuploadtmp"

5. Modify date. timezone. Otherwise, an error will be reported in date when phpinfo is executed:

Warning: phpinfo () [function. phpinfo]…

We need

1 ; Date. timezone =

Change

1 Date. timezone = Asia/Shanghai

You can also click here to learn more about the configuration of PHP. ini.

So far, the PHP environment configuration on Windows 7 is complete, but it is not enough to complete these configurations. We need Apache to support PHP, therefore, you also need to complete the corresponding PHP configuration in the Apache configuration file.

Step 5: Configure Apache to support PHP

1. Under # loadmodule vhost_alias_module modules/mod_vhost_alias.so, add

1
2
3
Loadmodule php5_module "C:/PHP/php5apache2_2.dll"
Phpinidir "C:/PHP"
Addtype application/X-httpd-PHP. php. html. htm

We can see multiple php5apache DLL files under the PHP Directory. Because we are using apache2.2.15, we certainly need to use php5apache2_2.dll, and then specify the PHP installation directory and program extension.

2. We should know that the directory for executing the Web main program on the Apache server by default is apache2.2/htdocs. Therefore, when your web main program directory is changed, we need to modify the corresponding Apache configuration.

1 DocumentRoot "C:/program files/Apache Software Foundation/apache2.2/htdocs"

Change

1 DocumentRoot "D:/phpweb"
1 <Directory "C:/program files/Apache Software Foundation/apache2.2/htdocs">

Change

1 <Directory "D:/phpweb">

3. Finally, modify the order of the specific index file. Because the PHP function is configured, index. php is required for priority execution.

1 Directoryindex index.html

Change

1 Directoryindex index. php index.html

4. Restart the Apache server

Now, the PHP environment configuration on the Apache server is complete. You only need to create a new PHP file in the D:/php web directory and write

1
2
3
<?
Phpinfo ();
?>

Enter http: // localhost in the browser to view the specific PHP configuration page, which means that the PHP environment configuration is complete on window 7.

ArticleFrom: http://www.leapsoul.cn /? P = 695

"How to configure the environment for PHP and Apache in Windows 7"

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/330431.html pageno: 11.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.