Configure the PHP environment in Windwos8.1

Source: Internet
Author: User
Tags php session php file upload vc9
1. Download the installation package: Apache2.2: mirrors. cnnic. cnapachehttpdbinarieswin32httpd-2.2.25-win32-x86-openssl-0.9.8y.msiPHP5.4: windows.php.netdownloadsreleasesphp-5.4.22-Win32-VC9-x86.zip Mysql5.5: dev. mysql. comgetD

1. Download installation package: Apache2.2: http://mirrors.cnnic.cn/apache//httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y.msi PHP5.4: http://windows.php.net/downloads/releases/php-5.4.22-Win32-VC9-x86.zip Mysql5.5: http://dev.mysql.com/get/D

I.Download the installation package:

Apache2.2: http://mirrors.cnnic.cn/apache//httpd/binaries/win32/httpd-2.2.25-win32-x86-openssl-0.9.8y.msi

PHP5.4: http://windows.php.net/downloads/releases/php-5.4.22-Win32-VC9-x86.zip

Mysql5.5: http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.35-winx64.msi

Of course, the software version is not limited to the above, but there are two points to note:

First, openssl in the Apache Software Package indicates that the openssl module is included.ConfigurationSSL Secure link. If you use PHP in apache1 or apache2, you should select VC6. If you use PHP in IIS, you should select VC9;

Second, the difference between VC6 and VC9 in the PHP package: VC6 is compiled using visual studio 6, while VC9 is compiled using Visual Studio 2008, it also improves the performance and stability of using VC9 in Apache. To use PHP of VC9, you need to install Microsoft 2008 C ++ Runtime. Therefore, we recommend that you do not use VC9 in Apache.

In addition, it is our directory structure. To facilitate management, we install them in one piece. First, we create the WAMP folder, and then create the MySQL, PHP, and Apache folders respectively, later, we will install MySQL, PHP, and Apache in the corresponding folders. The directory structure is as follows:

II.Install software (many installation tutorials on the Internet are not mentioned here)

III.ApacheAnd PHPConfiguration

Find the php. ini-recommended file in the WAMPPHP folder, rename it to php. ini, and open it in the editor.

1. First find

1 ; Directory in which the loadable extensions (modules) reside.2 3 extension_dir = "./"

To:

; Directory in which the loadable extensions (modules) reside.extension_dir = "D:/Program Files/WAMP/PHP/ext"

(I installed it in the directory of Program Files on drive D, you can change it according to the actual situation) to specify the directory of the PHP extension package, so as to call the corresponding DLL file

2. Enable the extended library function

Find the following lines and remove the previous ";"

extension=php_curl.dllextension=php_gd2.dllextension=php_mbstring.dllextension=php_mysql.dllextension=php_mysqli.dllextension=php_pdo_mysql.dllextension=php_xmlrpc.dll

3,ConfigurationPHP Session Function

Required when using the session FunctionConfigurationThe session file is saved in the directory on the server. Otherwise, the session cannot be used. You need to create a readable directory folder. In this case, we will find the phpSessionTmp directory in the WAMP folder and find it in the php. ini file.

;session.save_path = "/tmp"

To:

session.save_path = " D:/Program Files /WAMP/phpSessionTmp"

4,ConfigurationPHP file upload function

When using the PHP file upload function, you must specify a temporary folder to complete the file upload function. Create a phpFileUploadTmp folder in the WAMP folder, and find

;upload_tmp_dir =

To:

upload_tmp_dir = "D: /Program Files /WAMP/phpFileUploadTmp"

5. Modify date. timezone. The default value is the U.S. time. If it is not modified, an error is returned.

Find:

;date.timezone =

To:

;date.timezone = Asia/Shanghai

Okay, for php. iniConfigurationBut this is not enough. We need Apache to support PHP, so we haveConfigurationComplete the corresponding PHP In the httpd. conf fileConfiguration.

Find the httpd. conf file in the D: \ Program Files \ Wamp \ Apache \ conf folder and open

6. Under # LoadModule vhost_alias_module modules/mod_vhost_alias.so, add:

LoadModule php5_module "D:/Program Files/WAMP/PHP/php5apache2_2.dll"PHPIniDir "D:/Program Files/WAMP/PHP"AddType application/x-httpd-php .php .html .htm

7. By default, the Directory of the main web program executed by the Apache server is Apache2.2/htdocs. For convenience, we have created a www folder in the WAMP to replace htdocs, therefore, you need to modify the corresponding ApacheConfigurationThe web program directory is changed to the www directory

Find:

DocumentRoot "D:/Program Files/WAMP/Apache/htdocs"

To:

DocumentRoot " D:/Program Files/WAMP/wwwroot"

Find:

 

Change

 

8. Modify the order of the index file.ConfigurationThe PHP function, of course, requires index. php to be executed first.

Find:

DirectoryIndex index.html

To:

DirectoryIndex index.php default.php index.html index.htm default.html default.htm

So farEnvironmentConfigurationIt's basically done. Let's give it a try.

Restart Apache, place a phpinfo. php file in WAMP/wwwroot, and write the code in phpinfo. php:

 

Enter http: // localhost/phpinfo. php in the address bar of the browser. Then, the page displays the basic information of PHP.ConfigurationInformation, so our PHPEnvironmentThe building is complete.

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.