Apache on Windows 7 (WampServer Solution)

This one comes straight from the trenches: May 2009, Windows 7 RC, and Apache refusing to bind port 80. Sixteen comments later it’s still one of the most-visited pages on this blog, because the underlying problem never went away — it’s the same on Windows 10 and Windows 11 today. Here’s the 2026 version, with the original 2009 write-up preserved below.

The symptom

Apache (or any local web server) fails to start on port 80. netstat -ano | findstr :80 shows the port owned by PID 4. Task Manager has no process named “PID 4” — because PID 4 is the NT kernel itself, System. Nothing you installed shows up as the culprit.

The actual culprit: http.sys

PID 4 listening on port 80 almost always means HTTP.sys, the kernel-mode HTTP driver that fronts IIS and anything else built on the Windows HTTP Server API. It isn’t listed in services.msc, which is why it’s so maddening to track down. Several services can bind port 80 through it: IIS (W3SVC), the Web Deployment Agent Service (MsDepSvc), SQL Server Reporting Services, Windows Remote Management, even print spooler edge cases.

Find who’s squatting on the port (2026 method)

Before nuking anything, ask HTTP.sys who registered which URL reservation:

netsh http show servicestate view=requestq

This lists the controller processes behind every registered namespace. Then check the usual suspects:

sc query w3svc
sc query msdepsvc
sc query w32time

Microsoft’s own guidance for the general case (any port conflict) is to identify the service via netstat -abno (elevated) or Process Explorer, then either stop it or move it. See netsh http on Microsoft Learn for the full command set.

Option 1 (recommended): free port 80 by disabling IIS

If you don’t use IIS, stop the front-end service — you don’t need to touch the kernel driver at all:

sc stop w3svc
sc config w3svc start= disabled

Note the space after start= — it’s mandatory sc.exe syntax, and its absence is the #1 reason people report “access denied”.

Option 2: disable HTTP.sys itself (the 2009 registry fix)

The original post reached for the registry because the driver hides from the Services applet. This still works, but treat it as the sledgehammer: with the HTTP kernel driver disabled, IIS and everything else built on HTTP Server API (including some SSDP/WebDAV functionality) stops working until you re-enable it.

  • Launch regedit
  • Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
  • Add a DWORD (32-bit) value named NoRun, set it to 1
  • Reboot

To re-enable later, set NoRun back to 0 and reboot. The sc config http start= disabled variant circulates on Stack Overflow as an equivalent; NoRun is the documented driver-level switch.

Option 3 (least invasive): just move Apache off port 80

For local development there is no shame in it. In httpd.conf:

Listen 8080

…and test with http://localhost:8080/. The Apache docs cover Windows-specific port and service behavior on their platform page.

And the two bonus problems from the original post

Both still bite people in 2026:

  • localhost resolves to ::1 — Apache bound to 127.0.0.1 only means http://localhost/ fails while http://127.0.0.1/ works. Bind Apache to both (Listen 80 plus Listen [::1]:80 or Listen 0.0.0.0:80) or fix the hosts file.
  • mangled hosts file — check C:\Windows\System32\drivers\etc\hosts for a commented-out 127.0.0.1 localhost line (or a stray IPv6 entry) and uncomment/clean it.

My original advice also included an antivirus angle — NOD32 in those days intercepted local loopback traffic. That story lives in its own post (and current ESET products expose the exclusion under Network protocol inspection rather than IMON).

WampServer in 2026

The official wampserver.com site is dead as of this rewrite (verified 404). If you want a batteries-included WAMP-style stack today, XAMPP or Laragon are the maintained options; a Wayback snapshot preserves the original WampServer pages.

The original 2009 write-up

I’m beta testing the next version of Windows, Windows 7, and came across a strange issue while trying to get Apache to install and run using the default port, 80. Running netstat -ano from the command line revealed that port 80 is being used by PID 4. Looking up PID 4 via PowerShell and Task Manager revealed that PID 4 is the NT Kernel — so Windows 7 by default appears to be using port 80. After a bit of hunting around the Internet and some research of my own I found that the http.sys service was the culprit and all I needed to do was disable it — but I could not find this service listed in the Services control panel applet.

So what’s the solution? You have to disable http.sys manually via the registry: launch RegEdit, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP, add a new DWORD (32-bit) value named NoRun, double-click it, set the value data to 1 and click OK, then reboot. You should now find that Apache starts on port 80!

You could also change the port to 8080 in httpd.conf in the Apache directory — change the Listen 80 line to Listen 8080 — then test http://localhost:8080/ in your browser.

But remember, one more thing: a recent update commented out the 127.0.0.1 localhost line in c:\windows\system32\drivers\etc\hosts. Uncomment it by removing the “#”. And also remember — NOD32 conflicts with local servers, as covered in a separate post.

16 thoughts on “Apache on Windows 7 (WampServer Solution)

  1. commaz says:

    Come on! BETA tester…
    Give us some real impressions over Windows 7!
    Is it worth a try?

    Reply
  2. Thomas (Belgium) says:

    Thanks for handing out the solution! Got the indian working 😉

    Reply
  3. teliaz says:

    Thanx and Have Fun …

    W7 really rox even on RC edition!!!

    Reply
  4. kek says:

    Another solution that does not need modification of the regestry.

    control panel->system and
    security->System->Advance System settings->performance->Data Execution Prevention->Turn on DEP->Add
    now go and find httpd.exe or whatever is your apache exe name is. restart, this also works for WAMP.

    Reply
  5. Wayne John says:

    Windows 7 is worth installing, IMO (so far). Thanks for posting this solution. I tried to get it to run last night after installing and realized that Win7 might be consuming port 80 already, yet I didn’t install IIS yet, so I found that odd. anyway, thanks for posting this. I’m going to give this a try tonight.

    Cheers!

    Reply
  6. Mauricio Lazo says:

    what an awesome thing to post! Sir, you rock, you answered every single question regarding this subject!

    Reply
  7. Pir Fawad Ali says:

    hi this is fawad i have a problem using windows7
    my apache server doesn’t run on this version of windows please tell me how to install & use apache server on windows7

    Reply
  8. oscar says:

    thanks that works perfect but is necessary always writte :8080 is possible just localhost?

    Reply
    1. teliaz says:

      in windows 7 its not only IIS using this port so its necessary.

      Reply
  9. zeescripts says:

    Latest release of wampserver on 24th december 2010 should fix all these issues. There is 64bit and 32bit versions separately available to download.

    Reply
  10. teliaz says:

    Solution was indeed found… just saw that with my own eyes!
    Although mssql_connect is not an option in latest wampserver releases.

    Reply
  11. David says:

    Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you so much!! =)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *