Build apache2 + mysql5 + php5 in windows. my personal summary
Assume that the system disk is D :/
Suppose: install everything in the PHPServer directory on the D drive.
Assume that the directory status is as follows after the installation:
Apache ---------------------------> D:/PHPServer/apache2
Mysql --------------------------> D:/PHPServer/MySQL Server 5.0
Php ----------------------------> D:/PHPServer/php5
WEB directory ------------------------> E:/phproot
Step 1: Set apache
Open the directory D:/PHPServer/apache2/conf/httpd. conf.
-------------- Change the WEB Directory -------
Find DocumentRoot "D:/PHPServer/Apache2/htdocs" and change it to your WEB directory.
Take my example:
DocumentRoot "D:/php/www"
-------------- Set the default homepage file -------
Find DirectoryIndex index.html. var and add index. php
-------------- Modular installation of PHP --------------
Find the # LoadModule ssl_module modules/mod_ssl.so line, and add a line after this line
LoadModule php5_module D:/PHPServer/php5/php5apache2. dll
Where D:/PHPServer/php5/php5apache2. dll is the location of php5apache2. dll in your php5 directory.
Find the AddType application/x-gzip. gz. tgz line, and add a line after this line
AddType application/x-httpd-php. php
(In fact, the above two lines are red. you can add them to the end of the httpd. conf file. it's just a matter of my habits)
+ -----------------------------------------------------
| Note: The apache service is automatically installed and started after the installation is complete. if any problem occurs here:
| "(OS 10048) generally, each socket address (Protocol/network address/Port) can be used only once:
| Make_sock: cocould not bind to address 0.0.0.0: 80... "is generally caused by IIS occupying port 80.
| Solution: Open Control Panel-> service find IIS admin service close and disable
| Then run CMD to enter the directory/apache2/bin where apache is installed.
| Input
| Apache-k install
| Apache-k start
| If it succeeds, proceed with the following!
+ --------------------------------------------------------------
Step 2: Set php. ini
D:/PHPServer/php5 find the php. ini-dist in the php Directory
(It seems that this is a habit. In fact, I prefer to use php. ini-recommended) rename it as php. ini and copy it to the windows system Directory (in special cases, the win2k system directory is winnt)
My win2003 is installed on the d drive, so php. ini is copied to the d: \ windows directory.
Then, set the php5ts in the php5 directory. dll, libmysql. in the dll and \ ext directories, copy php_gd2.dll, php_mysql.dll, and php_mbstring.dll to the system directory, for example, D: \ windows \ system32 (or c: \ windows, my personal habit is system32)
Configure php. ini and test mysql and GD2 (php. ini is c: \ php. ini in windows)
Find; extension = php_mysql.dll and change ';' to extension = php_mysql.dll.
Find; extension = php_gd2.dll remove the previous one; to support the GD Library extension = php_gd2.dll
Find; extension = php_mbstring.dll remove the previous one; to support the character Library extension = php_mbstring.dll
You can configure other templates in the same way.
Create the index. php file in the Web root directory (such as E:/phproot/) as follows:
PHP code:
$ Link = mysql_connect ('localhost', 'root', '000000'); // Here, root and 123456 are MYSQL Users and passwords. please modify them according to your own situation.
If (! $ Link) echo "fail ";
Else echo "success ";
Mysql_close ();
?>
Open http: // localhost/testdb. php in a browser. if success is output, it will be OK.