Building a PHP development environment in Windows there are many PHP development environments, such as XAMPP and AppServ ...... the PHP environment has been set up with one click. However, this installation method is not flexible enough, the free combination of software is not convenient, and it is not conducive to learning. Therefore, I still like to build a PHP development environment manually. which mode is required for building a PHP development environment in Windows?
Build a PHP development environment in Windows
There are many Integrated PHP development environments, such as XAMPP and AppServ ...... the PHP environment can be set up with one-click installation. However, this installation method is not flexible enough, the free combination of software is not convenient, and it is not conducive to learning. Therefore, I still like to build a PHP development environment manually. you only need to install the module or upgrade the software without affecting other software, very convenient.
?
I. preparations-download required software
- Apache ?? Httpd-2.2.22-win32-x86-openssl-0.9.8t.msi
- PHP ??????? Php-5.3.10-Win32-VC9-x86.zip
- MySQL ??? Mysql-5.5.20-win32.msi
?
II. install software
Install Apache: Double-click installation, which is no different from installing other Windows software. when you enter Server Infomation, there is no special rule as long as the entered information conforms to the format.
After the installation is complete, enter http: // localhost in the browser. if It Works is displayed !, Indicates that Apache is successfully installed.
?
Install PHP: Extract php-5.3.10-win32-vc9-x86.zip to a directory.
Install MySQL: Double-click the installation. to change the installation directory, select Custom in Choose Setup Type.
After the installation is complete, start configuring MySQL. keep all the default options, but you 'd better change the default MySQL encoding to utf8. set the password in the Modify Security Settings option and enter the password twice, click Execute to complete the configuration.
?
3. integrate Apache + PHP + MySQL
Apache: first, modify the Apache configuration file so that Apache can parse the php file. The Apache configuration file is httpd. conf in the conf Directory of the Apache installation directory.
?
1. Apache can parse the php file and find it in the configuration file.
# LoadModule vhost_alias_module modules/mod_vhost_alias.so
Add in the next line (the green position depends on the directory where PHP is located)
LoadModule php5_module"D:/Develop/PHP/php5apache2_2.dll"
PHPIniDir"D:/Develop/PHP"
AddType application/x-httpd-php. php. html. htm
?
2. find
DirectoryIndex index.html
Change
DirectoryIndex?Index. php? Index.html
?
3. modify the Directory of the Apache site and find it in the configuration file (the directory for Apache installation is different and the displayed value is different)
DocumentRoot"D:/Develop/Apache2.2/htdocs"
Change
DocumentRoot"D:/Workspace/PHP"? ? (Here is the php code directory)
Find
D:/Develop/Apache2.2/htdocs">
Change
D:/Workspace/PHP"> (Here is the php code directory)
?
?
?
PHP: rename php. ini-development to php. ini as the PHP configuration file. Modify php. ini
?
1. set the Directory of the PHP extension package and find
; On windows:
; Extension_dir = "ext"
Change to (the value is the Directory of the ext folder)
; On windows:
? Extension_dir ="D:/Develop/PHP/ext"
?
2. enable the corresponding library function and find the row of the library to be enabled
; Extension = php_curl.dll
; Extension = php_gd2.dll
; Extension = php_mbstring.dll
; Extension = php_mysql.dll
; Extension = php_xmlrpc.dll
? Remove the semicolon (comment) and change it
Extension = php_curl.dll
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mysql.dll
Extension = php_xmlrpc.dll
3. set the time zone and find
; Date. timezone =
Change
Date. timezone = Asia/Shanghai
After the configuration is complete, check whether the configuration is successful. Restart Apache, create the file index. php in the site directory, and enter the following content:
?
?
Open the browser and enter http: // localhost. if the following content is displayed, the installation is successful and MySQL is associated successfully.
?