Apache and PHP are installed step by step.
The default installation path is selected during installation. After httpd. conf and PHP. ini are configured according to the steps, the default home page of localhost is displayed, showing the normal installation of PHP.
The new PHP test page is as follows:
<HTML>
The page cannot be opened and the apache service is not restarted after the configuration is found. Therefore, use monitor to restart. The requested operation has failed error is returned.
Possible reasons for Baidu:
Cause 1: Port 80 occupied
For example, IIS and thunder. To check the port, enter netstat-An in cmd and you will see that each port is occupied. If it is occupied, you can end the corresponding process or change the listen port in httpd. conf.
Cause 2: Software conflict
If some software is installed, Apache cannot start such as dr.com. Choose network connection> TCP/IPv4 Properties> advanced> wins to remove the LmHosts check of NetBIOS, disable NetBIOS of TCP/IP, and then start NetBIOS.
Cause 3: httpd. conf configuration error
If the configuration file httpd. conf of Apache is incorrect.
Run cmd to enter the bin directory installed by Apache, and then run
Apache-T
Check the Configuration File Syntax. If there is no error (it is not true that there is no error), run the following command:
Apache-w-n "apache2"-K start
, Some errors will be prompted here, you can find the corresponding solution.
However, my problem is due to the third reason. However, the above method cannot be detected. The last method to enable the apache2 service is not abnormal, but it still cannot be started in Monitor, and PHP cannot be parsed.
Carefully check the last lines added to the httpd. conf configuration file as follows:
Phpinidir "C: \ Program Files \ PHP" loadmodule php5_module "C: \ Program Files \ PHP \ php5apache2. DLL "addtype application/X-httpd-PHP. phpaddtype application/X-httpd-PHP. html
The error is actually here. When I add a directory, my path is copied directly from windows,The path should be a forward slash., Correct the above several lines, and the restart is successful. Run the test page above to get the phpinfo information. The correct conf behavior:
Phpinidir "C:/program files/PHP" loadmodule php5_module "C:/program files/PHP/php5apache2. DLL "addtype application/X-httpd-PHP. phpaddtype application/X-httpd-PHP. html