Build apache2 + mysql5 + php5 in windows. my personal summary

Source: Internet
Author: User
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.

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.