After a long run Apache on my machine suddenly stopped working. I tried everything including removing recently added virtual hosts but nothing worked. I also restored original http conf file but there was no luck. It was hard to guess what is actual issue because service log message was not very much clear enough. I did following steps to figure out exact cause and resolution. I hope this will help readers.

1. Open command prompt and go to Apache bin directory. In my case it was D:\www\Apache22\bin\

2. Run httpd.exe by typing in the command prompt.

run-apache-from-command-prompt

3. Here you will see exact error message. See screenshot above.

4. According to error message It is clear that some application captured port 80 on which Apache is running.

5. Now it is time to find out which application it is. Run following command  netstat -ano in the command prompt to see list of application running on port 80.

netstat-ano-command

6. As you can see one service running with PID 4 on port 80. This could be different for different people. Skype also run on port 80 sometimes depend on configuration. So for some people it can be resolve just by configuring Skype on different port. But for me this was not the case.

7. Process ID 4 belongs to IIS Web Deployment Agent Service usually only start if web matrix installed on system. So for my case I disabled this service as i rarely use web matrix.

8.  To disable this service Go to Control Panel -> Administrative Tools -> Services -> Web Deployment Agent Service  and disable the service. Exit then Start Apache.

web-deployment-agent-service

Apache should start now. You may try the following trick if Apache still fails to start and port 80 not captured by PID 4.

1. Exit from skype and try restarting Apache. If it works then configure Skype on different port. Go to Tools -> Options -> Advanced -> Connection. then un-check “Use port 80 and 443 as alternatives for incoming connections”.

2. Check virtual host defined in virtual host file. Log folder defined in the virtual host must be exist. If not Apache will throw this error.

 

 

 

 

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.