Thought Patterns

Cameron’s thoughts on everything and nothing.

Getting Apache to run on port 80 on Windows 7

| 125 Comments

Update

This solution is no longer necessary. It turns out a service called BranchCache is the culprit. Disabling this service stops Windows from listening on port 80 thus allowing you to run a web server. The description for BranchCache under services.exe is ‘This service caches network content from peers on the local subnet.’

Thanks to a fellow beta tester for the latest resolution.

I’m currently 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 the command ‘netstat -ano’ from the command line revealed
that port 80 is being used by PID 4.

Looking up PID 4 using Power Shell and then 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 doing some research of my own I found that the service http.sys 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 the http.sys service manually via the registry:

1) Launch RegEdit:

2) Go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP

3) Add a new DWORD (32-bit) value

4) Name it ‘NoRun’ not including the quotes

5) Double click the new property

6) In the Value data field type ’1′ not including quotes and click OK

7) Re-boot your computer

You should now find that Apache will start on port 80!

Bookmark and Share

125 Comments

  1. @cosmin
    Yeah Cosmin, I was just kidding.
    I’m enthusiast with my brand new windows 7, as much as I am in love with XP, but such problems made me drive bananas. After all, after having fixed that problem the first time, and then the services restarted, I had no more problems. Maybe due to some automatically installed patch, or something changed within the windows configuration.

  2. Just stop the service SQL Server Reporting Services (MSSQLSERVER), that’s all.

  3. Fred :
    1. Get pid that is listening port 80: netstat -nao | find “:80″
    2. Open task manager, go to processes tab and check “PID” on menu/view/Select Columns…. then you can find out the progress with that pid.
    3. If it is a normal application or IIS, just disable or uninstall it.
    4. If it is System progress(PID 4), you need to disable HTTP.sys driver which is started on demand by other service, such as Windows Remote Management/Print Spooler on Windows 2008 or Windows 7. there is two way to disable it:
    a.
    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 (and disable or manual some services depended on it).
    2) Reboot and use netstat -nao | find “:80″ to check no 80 is used.
    b.
    1) Launch RegEdit
    2) Go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
    3) Change the value of ’start’ to 4 (disabled)
    4) Re-boot your computer

    I just followed the steps from (b), now my wamp server is working fine… thank you very much… after a week I got the solution :)

  4. After fixing the port 80 problem by disabling UAC I now get this error:
    The system cannot find the specified file. : No installed service named “Apache2″.
    I get this after installing a fresh version (2.0.52) I used on the XP Pro system then copying over the Apach Group folder or if I just start with a freh install of v2.2.14 Would I be better off to just install Window XP Pro over this Windowes 7 Pro system

  5. Guess I spoke (wrote)too soon. Apache 2.0.05 was giving me too much trouble so I upgraded to 2.2.14. This eliminated the No Service Installed error, and the system does come up in localhost mode, but when it loads I get:

    (OS 10048) Only one use of each socket address (protocol/network address/port)is normally permitted. : make_sock: could not bind to address 0.0.0.80. No listening socket available.
    Shutting down. Unable to open logs.

    I ran netstat -ano | find “:80″ and it indicated LISTENING PID 80

    I’m not sure how to trace that or what might be causing it.

  6. i have done the above an disable the service BranchCache still no joy windows is still listining on 80

  7. Hello. This is my instruction (we simply change the way to run):

    1) Launch RegEdit:

    2) Go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP

    3) Find a DWORD (32-bit) value ‘Start’ not including the quotes

    4) Go to the properties

    5) In the Value data field type ‘0′ not including quotes and click OK

    6) Re-boot your computer

    You should now find that Apache will start on port 80!

  8. @NeoXidant
    This does work, but it kills off windows printing services which relies on that HTTP component.

  9. Hi !

    For those of you who have problem using EasyPHP or any other web server and using Skype. Make sure to change the port skype whas using. By default, skype use port 80 ans this will block any apache server to be lauch.

    If you have able to install Skype, you should be able to changed the setting.

    Hope this post will help any body.

  10. Pingback: Vertrigo nao inicia no windows 7 » Ti4Ti – O Seu blog de Tecnologia !!

  11. I think learning is always better than picking a short way out. I have the problem and am seeking to resolve it.

  12. I have an alternate suggestion for Windows 7

    In general, messing with the ports that your Operating System is using just seems like a bad idea, you’ll end up with weird network issues like printing ;)

    In addition, I need to have IIS running locally as well for the .NET projects I take on so having two web servers listening on different ports was important.

    For me the best situation was simply to change the IP Port that Apache listens on (the default is port 80, which is the standard for all web traffic).

    I changed mine to port 8666 (but it could be anything above 1024), I did the following:

    Locate the httpd.conf file in the following directory [install directory]\xampp\apache\conf (mine was in, C:\xampp\apache\conf)

    Find the line that says, Listen 80 and I changed it to Listen 8666. Save and Close the file and now Start the Apache service in the Xampp control panel. Life should be good.

    Now the only catch to this method is that you can’t just go to http://localhost/xampp anymore you have to tell your browser which port specifically to use (it will by default use 80), so you will have to use http://localhost:8666/xampp/ (the port is designated by the colon and then the number).

    The cool thing is I can run http://localhost:8666 to run Apache and http://localhost:8616 to run my local IIS for .NET projects.

    I hope this helps someone

    Jeremy

  13. I had this problem with SQL Server 2008 Enterprise Reporting Services. Disabling it works!

  14. @David
    Thanks for that reply. Disabling the SQL Server 2010 Reporting Service saved me after 3 hours of doing nothing but browsing the web for a solution

  15. thanks David, my problem was Reporting Services too.

  16. skeptigator :
    I have an alternate suggestion for Windows 7
    In general, messing with the ports that your Operating System is using just seems like a bad idea, you’ll end up with weird network issues like printing
    In addition, I need to have IIS running locally as well for the .NET projects I take on so having two web servers listening on different ports was important.
    For me the best situation was simply to change the IP Port that Apache listens on (the default is port 80, which is the standard for all web traffic).
    I changed mine to port 8666 (but it could be anything above 1024), I did the following:
    Locate the httpd.conf file in the following directory [install directory]\xampp\apache\conf (mine was in, C:\xampp\apache\conf)
    Find the line that says, Listen 80 and I changed it to Listen 8666. Save and Close the file and now Start the Apache service in the Xampp control panel. Life should be good.
    Now the only catch to this method is that you can’t just go to http://localhost/xampp anymore you have to tell your browser which port specifically to use (it will by default use 80), so you will have to use http://localhost:8666/xampp/ (the port is designated by the colon and then the number).
    The cool thing is I can run http://localhost:8666 to run Apache and http://localhost:8616 to run my local IIS for .NET projects.
    I hope this helps someone
    Jeremy

    Hey mate, I followed your instructions but I think I did something wrong here. I am using Xampp version 1.7.3, and do have to turn on SVC by installing them or do I turn them on by the start button for ‘Apache’ and ‘MySql’?

    I appreciate your help
    CHEERS :)

  17. DM :

    skeptigator :
    I have an alternate suggestion for Windows 7
    In general, messing with the ports that your Operating System is using just seems like a bad idea, you’ll end up with weird network issues like printing
    In addition, I need to have IIS running locally as well for the .NET projects I take on so having two web servers listening on different ports was important.
    For me the best situation was simply to change the IP Port that Apache listens on (the default is port 80, which is the standard for all web traffic).
    I changed mine to port 8666 (but it could be anything above 1024), I did the following:
    Locate the httpd.conf file in the following directory [install directory]\xampp\apache\conf (mine was in, C:\xampp\apache\conf)
    Find the line that says, Listen 80 and I changed it to Listen 8666. Save and Close the file and now Start the Apache service in the Xampp control panel. Life should be good.
    Now the only catch to this method is that you can’t just go to http://localhost/xampp anymore you have to tell your browser which port specifically to use (it will by default use 80), so you will have to use http://localhost:8666/xampp/ (the port is designated by the colon and then the number).
    The cool thing is I can run http://localhost:8666 to run Apache and http://localhost:8616 to run my local IIS for .NET projects.
    I hope this helps someone
    Jeremy

    Hey mate, I followed your instructions but I think I did something wrong here. I am using Xampp version 1.7.3, and do have to turn on SVC by installing them or do I turn them on by the start button for ‘Apache’ and ‘MySql’?
    I appreciate your help
    CHEERS

    lol..I got it going friend ;)
    Thanks for the valuable info.

  18. @David
    I have the same issue with SQL server 2008, and you where right about sql server was using port 80, it`s been changed tu use port 8080.
    Apache now starts without complainings on por 80.

  19. Comment #26 by Fred (which I have quoted below) is absolutely awesome. It sums up all reasons that are discussed in this thread, plus more !
    Brilliant job Fred ! Thank you very much.

    - Oh! and … for me, it was ‘World Wide Web Publishing Service’ that caused the problem.

    Fred :
    1. Get pid that is listening port 80: netstat -nao | find “:80″
    2. Open task manager, go to processes tab and check “PID” on menu/view/Select Columns…. then you can find out the progress with that pid.
    3. If it is a normal application or IIS, just disable or uninstall it.
    4. If it is System progress(PID 4), you need to disable HTTP.sys driver which is started on demand by other service, such as Windows Remote Management/Print Spooler on Windows 2008 or Windows 7. there is two way to disable it:
    a.
    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 (and disable or manual some services depended on it).
    2) Reboot and use netstat -nao | find “:80″ to check no 80 is used.
    b.
    1) Launch RegEdit
    2) Go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
    3) Change the value of ’start’ to 4 (disabled)
    4) Re-boot your computer

  20. Works perfectly. Thanks.

  21. Fred’s answer was full of good tips. Using his procedure, I found that in my case it was TeamViewer that was hogging port 80. Bad since that’s the remote admin tool I was using at the time. (I use RDP from my Mac for the other Windows machines… but they run XP and this machine runs Windows Home “Premium” which doesn’t support RDP.

    Well, actually it does… you can use this “home” version of Windows to control other computers via RDP, but no one can support you by controlling yours using RDP. Typical backwards M$ thinking I guess. (And just one of a number of crippled features in “Home Premium” Microsoft neglects to mention on their edition comparison charts.)

  22. Thanks, Moosa. Works a treat

  23. http://support.microsoft.com/kb/149605

    The above link shows you how to change the IIS port bindings. I changed them to port 8585 which allowed Apache to start flawlessly. Now how to change windows remote management https port to other than 443… that’s what I would like to know.

  24. Hi
    I ve searched the web all around and this page is far the best with suggestions.
    Though, I dont get a totally good solution…

    I am with Windows 7 integral 64 bits and Easyphp 5.3.1.0

    1> I ve tried changed the port for Apache to 8080, through Apache config file
    Then the servers start, I can access them but…
    I am blocked when I try to configurate the database acces of my CSS: normally I should put “localhost”, now when I put either localhost:8080 or 127.0.0.1:8080, it does not work…

    2> I’ve tried Fred’s method #1 above, that is disable the http within the device manager.
    Then, Apache starts on port 80 and I feel happy :)
    But then, none of my printer (pdf printer, etc) works, I guess it is sthg Windows needs to work

    3> I’ve tried Fred’s method #2 above, that is modify the registry
    Unfortunately, apache still does not work…

    4> I ve went trhough Microsoft link above, but I can’t find sthg that applies to Windows 7

    If anyone has an idea, especially with Fred’s method that seems best.?..

    Thanks

  25. NB: is there no way to get Windowsz http.sys run on another port?

  26. For now, the best way I ve found is to turn http service on and off…
    - When I need Easyphp, I run cmd and
    net stop http
    - WHen I need the spooler, I run cmd and
    net start http

  27. Oups… I had not seen the update on top of page
    For me works perfect, with Windows 7 64 bits ultimate and Easyphp 3.5.1:

    1> disabling brandcache service,
    => allows Apache to run on port 80

    2> in C:\Windows\System32\drivers\etc\hosts file
    Remove # to reenable instruction to use 127.0.0.1 as localhost
    => enable me to use localhost and declare it in my CMS as database location

    # localhost name resolution is handled within DNS itself.
    127.0.0.1 localhost
    # ::1 localhost

  28. @Parthipan
    Thanks, I just used option(b) now my xammp is running in port 80.
    Thanks a lot!!

  29. Naren :
    @Parthipan
    Thanks, I just used option
    1) Launch RegEdit
    2) Go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
    3) Change the value of ’start’ to 4 (disabled)
    4) Re-boot your computer now my xammp is running in port 80.
    Thanks a lot!!

  30. @David

    Same here. Thanks for the pointer.

  31. skeptigator :
    I have an alternate suggestion for Windows 7
    In general, messing with the ports that your Operating System is using just seems like a bad idea, you’ll end up with weird network issues like printing
    In addition, I need to have IIS running locally as well for the .NET projects I take on so having two web servers listening on different ports was important.
    For me the best situation was simply to change the IP Port that Apache listens on (the default is port 80, which is the standard for all web traffic).
    I changed mine to port 8666 (but it could be anything above 1024), I did the following:
    Locate the httpd.conf file in the following directory [install directory]\xampp\apache\conf (mine was in, C:\xampp\apache\conf)
    Find the line that says, Listen 80 and I changed it to Listen 8666. Save and Close the file and now Start the Apache service in the Xampp control panel. Life should be good.
    Now the only catch to this method is that you can’t just go to http://localhost/xampp anymore you have to tell your browser which port specifically to use (it will by default use 80), so you will have to use http://localhost:8666/xampp/ (the port is designated by the colon and then the number).
    The cool thing is I can run http://localhost:8666 to run Apache and http://localhost:8616 to run my local IIS for .NET projects.
    I hope this helps someone
    Jeremy

    Thanks Jeremy, that worked a treat. I’ve been trying to set up EasyPHP on my Win7 machine and had tried everything else – disabled skype, disabled the BrandCache and still there was something listening on 80. So your method of getting apache to listen on a different port worked fine. Thank!

  32. My problem was with SQL Server 2008 Reporting Services. I found that you can change the port that Apache listens on (that works! I used 8666). However, if I turned off Reporting Services and changed it to run manually I could execute Apache on port 80 (no reboot required).

  33. Bonjour,

    A lire tous les commentaires concernant ce problème de port avec Apache et le conflit avec Windows 7, je ne sais pas ce que je dois faire. Chacun y va de sa recette mais aucune n’est la vraie solution. Il y a conflit entre Apache, Windows 7 et IIS7. Si je fais netstat -nao | find “:80″, je trouve adresse PID 4 avec listening. En cherchant plus loin, je trouve que ce port 4 correspond à NT Kernel & System… mais ça ne résous pas le problème. Que j’installe la dernière version de wampserver ou de EasyPHP, je me retrouve avec le même problème. Dois-je rentrer dans la base de registre, dois-je me priver des fonctions d’impression?
    Que faire?
    Merci d’apporter une réponse si cela est possible. je pense que Microsoft a voulu par là empêcher toute concurrence de venir faire le ménage. je n’apprécie pas du tout cette politique du pire.
    Cordialement.

    Mathsprof

  34. Agradecimiento total

  35. @David
    Yep, I had SQL Server 2008 R2 on my PC, I turned that off and problem is solved, GREAT!

  36. With eset smart security disable http checking and you will be able to run apache on port 80 :)

  37. Had a similar problem.

    The Remote Desktop Service was running on :80. I didn’t notice it because it’s masked as a svchost.exe process.

    Once I disabled the service, things ran fine.

  38. @skeptigator
    Jeremy you are a life-saver. THANK YOU

  39. Excellent post! Thank you for your update. I turned off BranchCache and Apache started working right away. This post saved me a ton of time! I had the problem fixed in 5 minutes.

  40. For my windows 7 home edition. The program blocking Port 80 is Skype.exe but not branchCache. I Ctrl+alt+Delete, using task manager, found skype.exe and then end process tree.

    BAM Apache runs!!! oh yeah

  41. Thanks david
    SQL Server 2008 Enterprise Reporting Services.
    Disabling it works!

  42. Thanks Steve!

    It’s indeed Skype that was messing with the startup of Apache! (I was trying to do a quick install with xampp).

  43. @David
    Thanks mate, that worked brilliantly on Vista as well.

  44. Skype was the problem also on my end. Thanks man!

  45. Pingback: Microsoft Web Platformer Installation Problems with Windows 7 « Dani J. Moss

  46. @Moosa
    Thank U sooo much. i solved my problem.:-)

  47. Fresh install of Windows 7 Standard Edition, it was not the BranchCache service that was using up port 80 on mine, but rather “World Wide Web (W3SVC) under “Local System” services, described as “Provides Web connectivity and administration through the Internet Information Services Manager”. Once this was disabled, port 80 freed up, and this survived a reboot changing the service to Manual.

  48. I think the BrandCache global disclaimer is misplaced, clearly does not apply to all folks.

Leave a Reply

Required fields are marked *.

*