68

I was trying to install Zend Server CE on my computer but when I got to the point were I need to choose the port for my Web Server it says: "Web Server Port: 80 Occupied". So I decided to check what is using Port 80 with CMD by typing: "netstat -o -n -a | findstr 0.0:80":

TCP     0.0.0.0:80     0.0.0.0:0     LISTENING     4

I check for PID:4 in Task Manager's Processes and Services. Seems PID 4 is "System".

So, what I want to know is how can I stop "System" (PID:4) from using Port 80?

INFO: I am using: Windows 7 64bit; Zend Server CE 5.5.0

apokaliptis
  • 1,982

7 Answers7

92

Ok, after searching the web for a while I found a solution to my problem.

Just follow these steps to diagnose and resolve your issue:

  1. Get pid that is listening port 80: netstat -nao | find ":80"

  2. Open task manager, go to processes tab and check “PID” in Menu/View/Select Columns…, then look for the process using the PID found in last step.

  3. If it is a normal application or IIS, disable it or uninstall. Some programs (such as Skype) have the option to disable its use of port 80.

  4. If it is a System Process—PID 4—you need to disable the HTTP.sys driver which is started on demand by another service, such as Windows Remote Management or Print Spooler on Windows 7 or 2008.

    There is two ways to disable it but the first one is safer:

    1.

    • Go to device manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (or set it to manual, some services depended on it).

    • Reboot and use netstat -nao | find ":80" to check if 80 is still used.

    2.

    • Launch RegEdit.

    • Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP

    • Change the value of "start" to 4, which means disabled.

    • Reboot your computer.

My solution was step 4.

apokaliptis
  • 1,982
33

I just had this issue after installing Windows 8 Pro - Build 9200. I tried several methods but couldn't get any of them to work. This one, however, fixed it.

You need to change the binded IP address for HTTP.SYS

netsh http add iplisten ipaddress=::

http://www.mikeplate.com/2011/11/06/stop-http-sys-from-listening-on-port-80-in-windows/

Dave
  • 25,513
neojp
  • 431
7

On my case it was WebMatrix. See possible solutions (including this one) here: http://www.sitepoint.com/unblock-port-80-on-windows-run-apache/

Basically:

Open Services from Administrative Tools and locate “Web Deployment Agent Service”. Stop the service and set it’s startup type to “Manual”.

The Web Deployment Agent Service is deployed with WebMatrix and was the cause of my woes. It may also be distributed with other applications installed using Microsoft’s Web Platform Installer.

6

PID 4 is hard coded to be the "System" process which is part of the system kernel.

If the port is occupied by the system, you probably had IIS enabled. See https://stackoverflow.com/questions/1430141/port-80-is-being-used-by-system-pid-4-what-is-that

billc.cn
  • 7,139
3

While using the command netsh http add iplisten ipaddress=:: did, indeed, allow Apache to start on my Windows 10 64 bit system, it wreaked havoc with trying to access localhost, as that was bound to :: instead of 127.0.0.1, even with the proper entry in my hosts file. What I ended up doing was to use this command instead: netsh http add iplisten ipaddress=0.0.0.0 This not only worked, but allowed browser access to localhost as well. For me this was a superior solution.

3

Open the Services list Find "World Wide Web Publishing Service" Stop it, and set it to Manual

Aaron
  • 181
0

I had process blocking a port that I needed to use for a docker container and it took forever to resolve. In my case it was PID 4 using port 80 too.

Thought I'd summarise all of the potential issues and solutions I found while trying to resolve - hopefully useful for someone else in future.


For anyone new coming to this, you can investigate the service using the respective port by following these steps to try to figure out what it is.

In Powershell we can check for what process is using this port:

netstat -aon | findStr /i "LISTENING"  | findStr ":80"

To check what process this is:

tasklist /FI "PID eq 4"

Another way to get the process ID using the port:

Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess

Check whether the port has ben reserved for use by another process with:

netsh int ipv4 show excludedportrange protocol=tcp

Also look in Resource Monitor to see if that gives you any more clues.


I tried all of the suggestions I found here and in other posts:

None of these worked to free up the port.

In the end I decided to check for any recent Windows Updates that could have caused it - there was nothing new in the last two weeks.

But when I check for recently installed applications (using Bulk Crap Uninstaller - it's excellent!) I noticed two 'apps' installed yesterday which I definitely didn't manually install so I think they somehow came through Win Update or an auto app update:

  • Microsoft Edge Webview 2 Runtime
  • Web Components

After uninstalling these, I had access to port 80 again!

To make sure it wouldn't happen again, I reserved the port for my own use:

netsh int ipv4 add excludedportrange protocol=tcp startport=80 numberofports=1