Oct 202010
 

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.’

 

 

  47 Responses to “Windows 7: PID 4 listening to port 8 – Apache cannot start”

  1. Great post! This was driving me nuts!! Thanks!

  2. Oh God! Thanks u soooo much for this. I have checked over 50 different posts and tried various solutions but to no avail. This worked like a charm!!! Thanks!

  3. Thanks Man

  4. Dude.. you are awesome.. Solved my problem.. 4 hours until I finally got to this blog

  5. “A new service called “Web Deployment Agent Service” (MsDepSvc) can also trigger “System” with PID=4 to listen on port 80.”

    Use Process explorer to kill the process

  6. Christian THANK YOU, you saved me another day of frustration. It was indeed the Web Deployment Agent Service…
    Cheers,
    and thanks again :)

  7. Yep, this caught me too. Cheers man.

  8. Christian, Yes that is what was causing it for me.

    Rather than kill it, I went to Services and made the service start manually instead of automatically. And then I stopped the service. That way, when you reboot, it won’t happen again.

    Man this helped! Thanks!

    -Corey

  9. Thanks Christian on the heads up on “Web Deployment Agent” Service. That was the culprit for me.

  10. Cheers Christian, spot on! Web Deployment Agent Service was on port 80.

  11. Tanx I had the same problem MsSQL Reporting service

  12. Thanks for this great post, it was driving me mad! The alternative name of the service at the bottom of your post saved me!

  13. Thank you, finally I found a solution.

  14. Man you rock! you saved me hours. My first thought was that IIS was but you were right. It was reporting services.

  15. Okay… Gotcha. 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.

  16. Thank you, that fixed my problem!

  17. I had been having problems with this for ages. Tried everything I thought possible. After reading your post disabled Microsoft Web Deploy 2.0 and the problem went. Thank you for taking the time to share your solution with us.

  18. God bless you!

  19. Thanks a lot!!!! I’ve already headache, until find this post!!!

  20. Oh man, thank you VERY much!

  21. Thank you I have been fighting with this all day long no luck you are the man

  22. Thank you so much..

    Finally at the end of the day i saw this post….
    It was indeed the Web Deployment Agent Service…

  23. I was receiving this error and with port 80 being used by PID4. It was the Web Deployment Agent Service that was causing the problem. Thanks very much for the information.

  24. Hey all,

    I’m a newbie when it comes to servers and coding and am doing self-learning using google and other such resources.

    Great info here.. but i have one problem..
    I am unable to find the “Web Deployment Agent Service” anywhere on my system. I got my desktop a couple of days ago and use windows 7 professional. Could it be the case that microsoft removed this service in the new windows packs? If so, then i am still unable to start apache from port 80 using xampp. I don’t know which services are SQL services so i don’t know how to progress. Any advice would be greatly appreciated!

    Thanks!

  25. I have no SQL services turned on and there is also no “Web Deployment Agent Service” listed at all. Apache still gives me the same error.. No luck for me with this fix. What I have listed under PID 4 is ks.sys. Is this ok to kill or not

  26. This is really usefull. That error was driving me crazy!

  27. I get same problem. But I get other solution. In my case, I disable, World Wide Web Publishing Service.

    Fiska

  28. I turned off all SQL Server services and still port 80 was unavailable. Turned out to be Microsoft Web Deploy 2.0. Grumble grumble.

  29. I had the same issue, but I didn’t have Microsoft Web Deploy, SQL Server or anything installed on my machine – this was on a Server 2k8 box too.
    Ended up using the command “net stop http” to get my port 80 available again.

  30. Huge thanx man! Made my day, it was Web Deployment Agent service as pointed out.

  31. Sir, thank you for this ! It works like a charm!

  32. Hi, thanks for the great pointers!

    I found on my system (Win7x64) the service called “World Wide Web Publishing Service” (W3SVC) was the culprit.

  33. I had to disable the World Wide Web Publishing Service as well

  34. Thank you thank you thank you… that was an annoying error.

  35. Thanks man. I had since last night with that…

  36. Thanks a lot man. I struggled with this for almost a day. In general, how do you detect which exact service the port is corresponding to?

  37. I am bookmarking this page so freaking hard i might break your hosting solution.

  38. For me the service “branch cache” had hold of port 80.

  39. Hello Mr.Tauseef ,
    Thanks a lot… u simply saved my head from bursting….

  40. Following are the possible solutions :

    1) Stop/Uninstall IIS
    2) Stop SQL server Reporting Service
    3) Check, if skype is not running on port 80
    4) Stop, Web deployment Agent Service

    Thanks a lot… you help me from this headache.

  41. For me the service “branch cache” had hold of port 80.

  42. Thanks a Milli. It was really helpful. Just what I needed.

  43. God bless you!

  44. For pid 4, I needed to stop the “world wide web publishing service” service. Im using wamp on windows 8.

  45. Simple and effective … thx… you saved my day

  46. Thank you very much, you saved my day!

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>