An error occurred while restarting Apache during Windows 7 + apache2.0.64 + php5.2.17 configuration.

Source: Internet
Author: User

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

 

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.