1. References: http://zhidao.baidu.com/question/74350698.html
Download PhP5: http://cn2.php.net/distributions/php-5.2.6-Win32.zip
Download Apache: http://down.chinaz.com/soft/18000.htm
I. Install and debug PHP
Because PHP is a zip file (not an install version), it is easy to install. just decompress it. Rename the decompressed php5.2.1-Win32 to PhP5. And copy it to the C directory.
The installation path is c: \ PhP5.
1. Find the php. ini-Dist or PHP. ini. Recommended file in the PHP Directory and rename it PHP. ini.
And copy it to the Windows directory of the system disk (take c: \ windows as an example ).
2. Copy php5ts. dll and libmysql. DLL under the PHP Directory to the c: \ windows \ system32 directory.
3. Copy the php_gd2.dll, php_mysql.dll, and php_mbstring.dll files in the PhP5 \ ext directory to the C: \ windows \ system32 directory.
If php_gd2.dll PHP is not loaded, the image cannot be processed. MySQL function libraries are not supported when php_mysql.dll PHP is not loaded.
Php_mbstring.dll supports wide characters when phpMyAdmin is followed.
4 open the c: \ windows \ PHP. ini file (associated with MySQL)
Set extension path
Find the line extension_dir with extension_dir = "./"
Change this row
Extension_dir = "C: \ PhP5 \ Ext"
C: \ PhP5 is the path for installing PHP. DLL cannot be loaded if the path is incorrect.
(Note: Some PHP versions are; extension_dir = "./" Remove the semicolon from the previous version)
Search for extension
Extension = php_mbstring.dll
Extension = php_gd2.dll
Extension = php_mysql.dl
Remove the semicolon before the preceding three items so that these DLL files can be loaded at Apache startup.
Of course, we copied these DLL files to system32
PhP5 Time Difference
<? PHP echo date ("Y-m-d h: I: s");?> Time Difference: eight hours
Why? The Time Zone settings are added for the PhP5 series. The default value is Greenwich Mean Time, which is 8 hours different from the East 8 zone in China.
Find the row in date. timezone
; Date. timezone =
Replace;
Date. timezone = PRC
Ii. Apache debugging and integration
1. Modify the website root directory
Find that DocumentRoot has such a line
DocumentRoot "C:/program files/Apache Group/apache2/htdocs"
This is the root directory of your website. You can modify it or use the default one. If you change it, you must modify the following one. Otherwise, the 403 error may occur.
Find this shoshould be changed to whatever you set DocumentRoot
There are two rows below it:
<Directory "C:/program files/Apache Group/apache2/htdocs">
Change the C:/program files/Apache Group/apache2/htdocs of the preceding two items to the directory you want.
2. Make Apache support *. php (webpage)
Find directoryindex index.html. var
Modify
Directoryindex index.html. var index. php
In this way, index. php can act as the default page.
3. modular installation of PHP in Apache
Find # loadmodule foo_module modules/mod_foo.so
Add a line after this line
Loadmodule php5_module C:/PhP5/php5apache2. DLL // Note: C:/PhP5/php5apache2. DLL is the path for installing PHP. do not set php5apache2. DLL and php5apache. DLL obfuscation. php5apache. DLL is only applicable to apache version 1. php5apache2 in the PhP5 compressed package. DLL is only applicable to apache2.0. *, if it is 2. 2. * In the above version, "cannot load C:/PHP/php5apache2. DLL
Into server: the specified module cocould not be found. "Or:" The requested operation has failed"
4. Find addtype application/X-gzip. GZ. tgz
Add a line after this line
Addtype application/X-httpd-PHP. php (remember: there is a space in the front !!!)
In this way, Apache can explain the PHP file.
5. Test
Create a phpinfo. php file under the root directory of the website.
<? PHP
Phpinfo ();
?>
Open in a browser
Http: // localhost/phpinfo. php
5. Test the association between PHP and MySQL Databases
Create a test. php file under the root directory of the website
<? PHP
$ Link = mysql_connect ("localhost", "root", "12345"); // change 12345 to your MySQL password.
If (! $ Link) echo "failed! ";
Else echo "successful! ";
Mysql_close ();
?>
Open http: // localhost/test. php In the browser
If the output is successful, it means it is done.
------------------------------------------------------------
2. The above is the original reference document. My first reference is http://www.cnblogs.com/pharen/archive/2012/02/06/2340628.html. But failed.
According to reference 1, Apache cannot be started after the configuration file is modified. Later it was found that php5appache2. dll version was incorrect when the configuration file was modified.
-----------------------------------------------------------
References: http://bbs.csdn.net/topics/380119856
Cause 1: Port 80 occupies IIS, for example, Thunder. My Apache server cannot be enabled due to Thunder!
Cause 2: Some software installed in the software conflict will make Apache unable to start, such as dr.com, you open the network connection-> TCPIP properties-> advanced-> wins tag to remove the NetBIOS LmHosts check, disable NetBIOS for TCP/IP. and then start it.
Cause 3: httpd. CONF configuration error if Apache configuration file httpd. conf is wrong. If you start it in windows, the system will prompt the requested operation has failed. This is depressing because it takes a long time to check the error. In fact, you can start Apache in command line mode with parameters. Apache will prompt you which sentence is incorrect, and then you can solve the problem accordingly.
Check the error method: Go to CMD and enter the Apache installation directory (for your own installation directory) \ bin> httpd.exe-w-n "apache2"-K start
(Apache2 in the quotation marks is changed to your Apache service name. My version is version 2.2.4 and the service name is apache2. You can find it in the computer service)
When a problem occurs in row 133 (Prompt: syntax error on line 133 ...........), open the Apache installation directory \ conf \ httpd. conf: Find the serveradmin of row 133rd (if there is no tool to determine the number of rows, press Ctrl + F and use the "serveradmin" keyword to search for the number. there are usually two rows, and the following is the one). This row is left blank after it, add a name as needed. For example, after ABC is added, it can be solved.