OK if you’ve installed Apache on Windows of any flavour you’re used to the occasional weird thing happening and preventing it from working, one of the most annoying is the ubiquitous “Cannot open logs” error in the System event log. This invariably means that something is listening on Port 80. To prove this for yourself you can go to your run command and enter:
netstat -o -n -a | findstr 0.0:80
The last number here is the process ID using it. This is most often IIS or other web relates service and is easy to resolve, but every so often (very often it would seem looking around on google) it appears to be PID 4 – which according to the Windows Task Manager is the NT Kernel and System. Not very helpful given killing this will result in a blue screen of death. Anyway tonight after much fiddling around I discovered that the thing that was hogging port 80 was nothing to do with IIS or web anything, it was SQL server reporting services. I turned off anything that resembled a SQL server services and voila Apache started again, no need for a reboot which had hitherto been my only solution. So problems with PID 4 listening to port 80? Check your SQL services and turn them off!
Addendum to PID 4 listening to port 8 – Apache cannot start
Thanks to Tauseef below who has also mentioned that “A new service called “Web Deployment Agent Service” (MsDepSvc) can also trigger “System” with PID=4 to listen on port 80.”
Bharat below (thanks Bharat) has also contributed “Web Deployment Agent service was triggering “System” with Port id= 4 to use Port 80. I disabled it in Services, changed back to Port 80 in Apache config and bingo, Apache started working on its default port. Then I uninstalled Microsoft Web Deploy 2.0 to permanently remove this problem.”
Sanoop says (Thanks!) – ‘For me the service “branch cache” had hold of port 80.’