Apache Crashes on Windows – Check Your Ports

Apache is one of the most popular web servers in the market today. It usually runs on Linux-based machines but lately there are more and more deployments, for development as well as other reasons, of Apache on Windows. Nowadays, running Apache web server on Windows is very common for PHP developers. Many developers develop their PHP application on their home windows or Mac and deploy to a remote Linux server.

The problem

I often find that Apache has a higher probability to crash (right at startup) in home windows than it has on Linux servers. It happens to me several times a week and also to a lot of my friends.
If you check the logs of the apache you find that 9 times out of 10 you get very little out of it, the Apache does not leave any log when it crashes on initialization.

The root of the problem is that your dev windows is usually also your personal desktop – with lots of applications, such as Instant Messengers and email clients, that connect to the internet on a regular basis.

The solution

Well, 9 times out of 10 the problem is that the Apache cannot listen/bind to the required port (port 80 or 8080) on the machine, and as a result the Apache crashes. It is what you would call in technical terms a Binding Exception.
Closing the application that has already bound to that port is the best way to solve this issue. I do it all the time with Skype – I tend to close my Skype when I startup my Apache and then re-run my Skype and let it find another port to work on.
Another solution would be to change the port of the Apache, but it is more complex and mandates that you alter your URLs, so just stopping the application that “stole the Apache’s port” is the best course of action.

1

Leave a Reply