1. Download related software:
Apache HTTP Server (httpd) 2.x: (Win32 binary)
PHP 5.x vc6 x86 thread safe: (vc6 compressed version is selected, and vc9 version is used for integration with IIS)
MySQL Community Server 5.x: (select the installation Version)
2: Install software:
Apache: installed by default. Click Next until the installation is complete.
PHP: unzip the package.
MySQL: installed by default. Select database encoding.
3: port problems:
The service is automatically started after Apache HTTP server is installed. The default port is80If the IIS service has been started, httpd cannot be started.
4: solution:
Stop IIS service: Control Panel> Administrative Tools> Internet Information Service (IIS) Manager> website> default website> stop (right side)
Change IIS port: website> default website> edit binding (right-click)> Edit> change port> restart
Change httpd port: installation directory-> conf-> httpd. conf-> SearchListen 80-> Change the port (for example8888)-> Restart the service
5. Configure Apache + PHP:
Browse: http: // localhost: 8888/. if:It works!The Apache HTTP server is successfully installed.
Set environment variables: System Properties> advanced system Settings> environment variables> system variables>PathAppend after:
% Java_home % \ bin; D: \ PHP \ ext \
Set the PHP Directory: Open conf-> HTTP. conf and add the following content at the end of the configuration file:
Phpinidir "D:/PHP /"
Loadmodule php5_module "D:/PHP/php5apache2_2.dll"
Added phpmime support: SearchAddtype or <ifmodule mime_module>-> Append:
Addtype application/X-httpd-PHP. php
Configure PHP: Rename PHP. ini-developmentPHP. ini
Note:You must restart the apache service to modify the configuration.
7. test whether the configuration is successful:
Go to the htdocs directory and create test. php. The Code is as follows:
<? PHP
Phpinfo ();
?>
<Browse: http: // localhost: 8888/test. php. The success page is shown in the figure below:
8: Configure MYSQL:
Add MySQL extension: php. ini->;Extension = php_mysql.dll-> remove the semicolon and enable php_mysql.dll.
Specify the MySQL database location: php. ini-> to extension_dir = "D: \ PHP \ Ext", that is, the Directory of php_mysql.dll.
9: test whether the configuration is successful:
Go to the htdocs directory and create dB. php. The Code is as follows:
<? PHP
If (! $ Link = mysql_connect ('localhost', 'root', 'root ')){
Echo 'database connection failed! ';
Exit;
}
If (! Mysql_select_db ('mysql', $ link )){
Echo 'this database does not exist! ';
Exit;
}
$ SQL = 'show databases ';
$ Result = mysql_query ($ SQL, $ link );
If (! $ Result ){
Echo 'mysql error: '. mysql_error ();
Exit;
}
While ($ ROW = mysql_fetch_assoc ($ result )){
Echo $ row ['database'];
}
Mysql_free_result ($ result );
?>
Browse: http: // localhost: 8888/DB. php. The success page is shown in the figure below:
10: Set the default page:
SearchDirectoryindex
Append index. php:
<Ifmodule dir_module>
Directoryindex index.htmlIndex. php
</Ifmodule>
10: Add a virtual directory:
Find:
<Directory/>
Options followsymlinks
AllowOverride none
Order deny, allow
Deny from all
</Directory>
Append:
Alias/dwz "D:/dwz /"
<Directory "D:/dwz/">
Options indexes followsymlinks
AllowOverride none
Order allow, deny
Allow from all
</Directory>
Browsing method: http: // localhost: 8888/dwz/
Successful PHP configuration page
MySQL success page with four default Databases