Sunday, November 18, 2012

How to run WAMP Server on Windows 8


Updated - 14th April 2013: (Solved)

As you might know that the post I made previously was just a way to get around this strange problem. After a long time, I've finally managed to find out the actual reason for this problem, which I want to share with all of you.


The thing is that Windows 8 is an IPV6-first Operating System and WAMP is, by default, configured to run with IPV4 only. This creates a conflict and hence we face this problem. To confirm that Windows 8 uses IPV6. Open the command prompt and type ping localhost and press the Enter key. You'll receive a reply from ::1 which is the loopback address for IPV6. 

So in order to properly tackle this problem, there's no need to follow the steps I mentioned in    my earlier post. Although my older post might have solved your problem, it isn't a proper solution. Here's what you should actually be doing.


Step # 1 - Changes in httpd.conf file

  • Goto the WAMP folder (in my case, I've installed it in my E drive) > inside it double click the bin folder > then apache > apache2.2.22 (or whatever version you have) > conf > inside this folder, you'll see a file named httpd which has a file type of CONF. Right-click on this file and open it with Notepad.
httpd file inside conf folder


  • After you've opened the httpd file in Notepad, press Ctrl + F or goto Edit > Find and search for Listen 80 text. After you find this text, just add a (hash symbol) at the start of this line to comment/or make it inactive. Then type the following text on the next line - Listen 0.0.0.0:80. Save and close this file and close Notepad.

Editing in httpd file

Step # 2 - Changes in the hosts file
  • Open Notepad again, but this time as an administrator, and open the hosts file. To do this in Windows 8, press the Window Key + W to open the Search app or alternatively, press the Window Key and directly type your search term. In this case we want to search for Notepad
Search for Notepad in Windows 8

  • After you see the Notepad application icon, right-click on it and you'll see some options at the bottom of the screen. One of them reads Run as administrator. Click on it and Notepad will run as an administrator.
How to run an app as an administrator

  • Inside Notepad, click on File > Open and go to the following location, C: > Windows > System32 > Drivers > etc. Inside this etc folder you won't probably see any file which is because the file type in the bottom-right corner is set to Text Document (.txt). Select the dropdown again and select the option of All. You'll immediately see a file named hosts. Double click on it to open it in Notepad.
Open Dialog of Notepad


  • Inside the hosts file, make sure that the line with ::1 localhost written on it is commented (by using the # symbol as explained above) and the line that has 127.0.0.1 localhost is uncommented (in simple words it should not have # sign at the start of the line). Save and close this file as well as Notepad. 
Editing in hosts file using Notepad

Step # 3 (Final Step) - Restart WAMP
  • I don't think this needs any explaination. But I'll explain it anyway. Click on the WAMP system tray icon at the bottom-right of the screen and select the Restart All Services option. That's it. You're done.

Restart WAMP

After restarting WAMP, open your browser of choice and type localhost. And there you go. As for the phpmyadmin, don't worry, just type localhost/phpmyadmin and yes it works too. 

Well I hope that this method will work for all of you guys because this time we've actually handled this problem the right way. I would love to see your comments about this update. See ya next time.



Older Version of this post (Just a hack)

I've recently started using Windows 8 on my PC and was very happy because of its great new look and feel.  But it was until I tried to open WAMP Sever on my machine. 

The problem I encountered was that WAMP's icon wasn't becoming green. Rather than that, it got stuck as an orange icon.


WAMP Server's Orange Icon  not turning Green

When I was using Windows 7,  I found out that this only happens whenever some other service or software is using our computer's Port 80 (HTTP port) and mostly it was Skype because of which I wasn't able to run WAMP properly.

On Windows 8 however, I wasn't able to find any solution to this problem. But then I came across a blog where someone had posted a solution for this, which I thought I should share with others as well. Here it is.

1. Left click on the WAMP Server system tray icon, then goto Apache > Service > Test port 80.


Checking which service is using Port 80

When you'll click on the Test Port 80 option, you'll see a cmd line screen that will display the name of the service that is using Port 80.  See the screenshot below:



Screen displaying information about Port 80


By doing this, you'll get to know which service (if any) is using Port 80. In Windows 8, by default, IIS 8 Server uses this port. When we install Windows 8, IIS 8 is also installed with it and unfortunately it automatically runs at the startup. So the only way we can make WAMP server run properly, is by Disabling this IIS 8 server.

How to Disable IIS 8 Server


1. Open the Control Panel by Right clicking on the bottom-left corner of the screen and select the option of Control Panel. Refer to the screenshot below:


Open Control Panel (Windows 8)

2. In the Control Panel window, search for administrative tools and click on the resultant Administrative Tools icon.


Search for Administrative Tools in Control Panel

3. After the Administrative Tools window is opened, double-click on Services. Another way to access the Services window is by going to Start -> Run -> and type services.msc in the run window. Click OK and the same Services window will open.


Administrative Tools Window

4. After the Services window is opened, scroll at the bottom and double-click on World Wide Web Publishing Service.


Services Window

How to view WWWPublishing Service in Services window

This step is optional and only for those who can't find World Wide Web Publishing Service in the Services window. Jump to point number 5 if you're not one of them. Anyway, here's how to solve this problem.

4a.  Open Control Panel (as explained above). 

4b. In the Control Panel window, click on Programs (refer to the screenshot below)


Control Panel window

4c. In the Programs window, click on Turn Windows features on or off under the Programs and Features heading. (refer to the screenshot below)


Programs window

4d. When you'll click on the Turn on Windows features on or off button, a small window will pop-up. It'll contain a list of Windows Features. Scroll down until you find Internet Information Services and click on the plus (+) icon to the left of it to expand it. On expanding the menu, you'll see that one of the options will be World Wide Web Services. Just click on the checkbox on the left of it and press OK button. Windows will load for sometime and it may ask you to reboot. Reboot it if you like. And you're done.


Windows Features window

Back to our main topic

5. In the World Wide Web Publishing Service window, locate the Startup type dropdown menu and select the option that says Disable and click OK.


World Wide Web Publishing Service Window

After Disabling the IIS 8 Server, restart your computer and then open WAMP server again. Hopefully it'll run properly. To make sure that no service is using Port 80, re-run the Test Port 80 window (as described above) and you'll see a screen similar to the one below:


Test Port 80 window that shows that the port is free now


How to run Localhost on Windows 8

After Port 80 is free, I tried to run localhost in my browser but I continuously received error messages as shown below:



Error Message I received even when the WAMP icon was Green



After getting the message that is shown above, I uninstalled Skype and reinstalled the latest version of WAMP Server but still I got the following message in my browser.



Forbidden error after uninstalling Skype

After spending hours and hours on trying to solve this problem, what I found out in the end was very frustrating for me. The only thing I had to do was Left-click on the WAMP Server system tray icon and click on Put Online option (as shown below). 


Select Put Online option from WAMP Server tray icon

After that, just go to your browser of choice, and type localhost in the address bar and Voila!! It works.


Finally, localhost works!!!!
But there's still one problem, even though your localhost has started working, it is possible that you won't be allowed to access phpmyadmin. To get around this problem, just type 127.0.0.1/phpmyadmin in your browser's address bar and hopefully it'll work.
   Anyway, that's it for today. Hope you enjoyed this post. Please comment if you have any questions/suggestions.

98 comments:

  1. Still forbidden the phpmysql even i put it online...

    ReplyDelete
    Replies
    1. Well if you've tried out everything I've mentioned then try this.

      1. Install wampserver

      2. Do the following changes

      a) C:\wamp\alias\phpmyadmin

      Deny from all ------> Allow from all

      b) Apache ---> httpd.conf

      Deny from all ------> Allow from all
      80 ------> 8080

      3. You are done

      let me know the result. Good Luck

      Delete
    2. This worked perfectly, thank you for posting this tutorial! Much easier than re-installing WAMP.

      Delete
    3. Hi My phpmyadmin was still having Forbidden, but after making sure localhost is uncommented in my host file. it worked.

      Thanks alot guys. keep up the good job.

      Delete
    4. Thanks. It worked perfectly. I thought I need to install new copy of WAMP server. But then, this tutorial helped me a lot.. thanks

      Delete
  2. Solution is simpler, after installing wamp, start wamp server, left click on icon in tray, Apache -> Service -> Install service and then Start service

    ReplyDelete
    Replies
    1. This helped me Thanks A lot!

      Delete
    2. wooohooo! thanks FRees :) it worked! i've install and resume services for both apache and mysql

      Delete
    3. Also don't forget to go into C:wamp and open wampmanager.tpl then change all instances of http://localhost/ to http://localhost:8080/. After your have installed the service.

      Delete
    4. thanks help me a lot

      Delete
    5. Thanks very much :))

      Delete
    6. thank you very much. Problem sorted

      Delete
    7. Thank you very much,you saved the day!

      Delete
  3. i have tried all the above methods, and for some strange reason the icon is still orange.

    i did: Apache -> Service -> Test port 80
    i got
    Your port 80 is actually used by
    Server: Apache/2.2/22 (Win32) PHP/5.3.13

    and i have also done the 'install service' thing on WAMP
    but it is still orange.

    any fixes would be appreciated

    ReplyDelete
  4. Thank you! Very well presented and it taught me something about windows 8 I didn't know.

    ReplyDelete
  5. I wanna say THANK YOU SO MUCH for the simply "localhost" solution. I spend 4 hours until come here and it's solved :D

    ReplyDelete
  6. Glad to know that you guys find this post helpful.

    ReplyDelete
  7. Thank you
    I was having the same problems and your post solved it/
    thanks

    ReplyDelete
  8. At least in my case, I can always use http://127.0.0.1 .

    I think the difference between offline/online is that in offline mode you can only access the server from your computer; whilst in online mode anyone can reach it (from your home network or from the internet if the router is properly configured.)

    Since I use WampServer for small development, I leave it offline and keep using 127.0.0.1 .

    ReplyDelete
  9. Thank you for a clear and easily understandable article. It has helped me a lot.

    ReplyDelete
  10. Extremely helpful! I never would have had the patience to figure all of this out. Bless you dude!

    ReplyDelete
  11. Replies
    1. I guess you mean it didn't work out for you right? Can you elaborate please

      Delete
  12. thanks men, it worked but my phpmyadmin is not having permission still.

    ReplyDelete
    Replies
    1. Type 127.0.0.1/phpmyadmin in your browser. Hopefully it'll work.

      Delete
    2. it doesn't work for me too... same problem after doing all the steps you mentioned... wamp works but phpmyadmin is not having permission...even i tried 127.0.0.1/phpmyadmin in my browser... dint work fo me... pls help me... it's urgent...

      Delete
  13. I had done the above.. localhost started working.. but phpmyadmin did not..
    But I reinstalled wamp with the latest apache version rather than the php version and bingo it worked

    ReplyDelete
  14. i couldnot find the World Wide Web Publishing Service after going to the administrative tools

    ReplyDelete
    Replies
    1. I've added a solution to your problem in step number 4a to 4d. Please read that. Hope it'll solve your issue.

      Delete
  15. I don't have enough words to say thanks. How simple it was and no one did explain it in a simple way!!! Many many thanks for the author. I had same issues with my WAMP Server, but these particular guidelines helped me a lot!!!

    ReplyDelete
  16. This is a nice post.thanks a lot to you. always i hope you keep nice .

    ReplyDelete
  17. Asalam-o-Alaikum,
    Thank You so much Raza, By chance i read your post 2 days back as im also using win8 & learning web development & today my trainer asked to install WAMP... This post has helped me a lot & installed it in just 10 min..

    Thank you So much....!

    ReplyDelete
    Replies
    1. Walaikumussalam,

      I'm glad it saved you from all the pain I went through

      Delete
  18. use wamp beta 2.3 its don't need any modification... works well with windows 8

    ReplyDelete
  19. That worked perfectly, Thanks for that!

    ReplyDelete
  20. thank you for giving a great tutorial on wamp installation

    ReplyDelete
  21. thanks bro. Hm at last, i will still get to keep this beatifull windows 8, because i was already anticipating to downgrade to windows 7. Thanks.

    ReplyDelete
  22. it doesn't work for me too... same problem after doing all the steps you mentioned... wamp works but phpmyadmin is not having permission...even i tried 127.0.0.1/phpmyadmin in my browser... dint work fo me... pls help me... it's urgent...

    ReplyDelete
    Replies
    1. Do the following:

      1. Goto your-wamp-installation folder\bin\apache\Apache2.2.22\conf\ here you'll find a file named httpd.conf, open this in notepad.

      2. Within this file, find and search for LISTEN 80. Remove this line and replace it with Listen 0.0.0.0:80. Save this file and close it.

      3. Open Notepad again but with administrative rights. Inside Notepad goto File > Open and locate the following C:\Windows\System32\drivers\etc. Here you'll see a file named hosts. If you don't see any file over here then it's because the file type is set to Text Document (.txt). Select that dropdown and select All option. Double click on the hosts file to open it in notepad.

      4. Inside the hosts file, just make sure that ::1 localhost is commented by putting a # sign at the start of this line. And uncomment or add 127.0.0.1 localhost in your file.

      5. Restart WAMP. And you're done.

      PS: This is a proper solution to this problem so now, if you want, you can select the PUT OFFLINE option again (which was just a way I found to get around this problem)

      Hope this will solve your problem

      Delete
  23. Awesome!! I spent a few hours trying to get this sorted - numerous "help pages" youtube videos etc, including a complete reinstall and your walk through was the first that actually got it sorted, so thanks!!

    ReplyDelete
    Replies
    1. This was the only reason why I posted this issue because I didn't find a proper solution to this problem. Thanks for your comment. Please keep visiting.

      Delete
  24. Great post, but unfortunately I didn't fix my problem with wamp. When I test port 80, it says that no one use port 80, but localhost couldn't be opened neither the phpmyadmin...

    ReplyDelete
    Replies
    1. Have you tried the method I've mentioned in the Updated section?

      Delete
  25. 0xc000007b error while installing apache services

    ReplyDelete
  26. In my case when I use "test port 80" in wamp server
    It gives

    Your port 80 is actually used by :
    Server: Microsoft-HTTPAPI/2.0

    my IIS service is already off
    so what I should do now

    ReplyDelete
    Replies
    1. Please read the section under the heading Updated - 14th April 2013: (Proper Solution). It'll solve your problem

      Delete
  27. H John, the solution to the Microsoft-HTTPAPI/2.0 problem can be found here http://www.ferolen.com/blog/microsoft-httpapi2-0-use-port-80-cannot-start-wamp-apache/

    ReplyDelete
  28. Thank you for the clear step-by-step explanations.

    ReplyDelete
  29. It worked perfectly for me and I also discovered something in the process, if your system does not have a certain msvcr100.dll, all the above updated steps might not work for you. This is because, the Apache web server has not yet been installed (strange eh..., this happened to me).

    To solve this problem, you'd have to download the missing file and store it in your windows system 32 folder i.e.(c:/windows/system32), then click install service for Apache on your wampserver ash tray menu. Once this is done, apache should popup a dialog box asking you to install the service afresh and then you refresh the server and everything now should respond ok and you have your wampserver running again.

    Funny, I just thought I'd share this with everyone, might help someone out there like me (I was almost freaking out...).

    ReplyDelete
    Replies
    1. Hey Gozie, I'm glad it worked out for you as well. Btw thanks for sharing your valuable findings. And hey did you share this post with anyone else?

      Delete
    2. No not really...

      Delete
  30. This helped me a lot thank you so much..

    ReplyDelete
  31. Thanks,this work for me.

    ReplyDelete
  32. Thank God.................My problem have been solved after seen that...... Thanks a lot :)

    ReplyDelete
  33. Thanks a lot for this post. Helped me solve my probs and get on with PHP coding :)

    ReplyDelete
  34. Thank you solved my dilemma! Found other forums but didn't solve my issues until your article. Many thanks.

    ReplyDelete
    Replies
    1. I'm really glad that this post has solved your problem.

      Delete
  35. If I want to use my tablet for testing my website on my home webserver , how can I do it ?
    I try to browse it with WAN IP of my home webserver but no luck.

    ReplyDelete
  36. this is a great article. worked for me. thanks

    ReplyDelete
  37. Works flawlessly, thank you.

    ReplyDelete
  38. Thx a lot. even tryng both ways wamp was still red but...
    Playing around with the wamp menus Wamp-->Apache-->Service found the solution, the apache server service was not installed (dunno why even after a clean install of wamp)so i just clicked the "Install service" and works again :D

    ReplyDelete
  39. Thank You!! You saved my day

    ReplyDelete
  40. It worked for me. Thank you so much

    ReplyDelete
  41. Pls help me..i did all the step that you mentioned it and after i restart the computer and start again the wamp and put it online then the Aetan trayt menu appeared..how is this? i need to do it my system..pls help me
    Could not Execute menu item (internal error)
    [Exception] COuld not service action:
    The service has not been started

    ReplyDelete
    Replies
    1. 1. Please make sure none of the following services is running on your system.

      IIS, Skype, Zone Alarm, NOD32, Eset, Internet Optimizer, Google Accelerator, any other database server, any other webserver

      If any one of the above application is opened, close it and select “restart all services” from WAMP menu.

      2. If nothing happens even after closing all applications mentioned above. Try changing your port from 80 to 8080 (As mentioned in my post above). Then select restart all services from the wamp menu.

      3. Other than that, make sure Microsoft Visual C++ 2008 Redistributable Package (x86) is installed

      Delete
    2. Try installing Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)

      - For 32bit Windows:
      VC10 SP1 vcredist_x86.exe 32 bits : http://www.microsoft.com/download/en/details.aspx?id=8328

      - For 64bit Windows:
      VC10 SP1 vcredist_x64.exe 64 bits : http://www.microsoft.com/download/en/details.aspx?id=13523

      Delete
  42. i really need quick respond..

    thanks..
    i've done all the things that i need to do-searching for the aestan tray menu and some solutions..everything is non-sense..

    i really hope that u help me because i really need to do my capstone system..tnx

    ReplyDelete
  43. Hi,
    i have followed every step that you mention above but wampserver icon not turned green.one thing skype was not running while i test it, also test port 80, showed "your port 80 is not actually used."...can you help me..

    ReplyDelete
    Replies
    1. Please try Method # 2, mentioned in the above post, with the heading of NOT A PROPER SOLUTION. It might solve your problem.

      Delete
  44. Thanks guys.....you rocked it....

    ReplyDelete
  45. for windows 8 user, just stop "Web Deployment Agent Service" in service menu now you can start apache again flawlessly

    ReplyDelete

  46. Thanks for sharing Windows 8 Support
    ,great post and information,if you find more informatin please visit this link

    Thanks & Regards

    Alex walker

    ReplyDelete
  47. Disabling WWW Publishing Service is all it took. Thanks.

    ReplyDelete
  48. Thnak's a lot for window 8 help .. Hope this will do better for all the developers

    ReplyDelete
  49. Go to control panel -> administrative tools -> services ->SSRS (SQL Server Reporting Services) then you just stop the SSRS (SQL Server Reporting Services) service then restart the wamp server then it automatically orange icon turns to green for more info just it out http://www.coderetina.com/port-80-used-by-microsoft-httpapi2-0-wamp-apache-error-fixed/ thanks

    ReplyDelete
  50. Hey thanx for info , All ok but i cant get access to phpMyAdmin , Whenever i click on this it shows "Server Error". Please help me

    ReplyDelete
    Replies
    1. Can you email me your phpmyadmin.conf file? It is located inside wamp\Apache2\conf\alias\phpmyadmin.conf. Secondly please email me the screenshot of the error you're facing.

      Delete
  51. Hi, So I read your whole solution and all that you mentioned seems to be irrelevant for me. I am getting an error in reference to apache I dont understand why all of the sudden my wamp server stopped working because it was fully functional only a few hours ago. I routed a domain name to my server, and everything was working except for when I tried to go to a different page on my wordpress website. All of the sudden out of no where it just ceased to restart, it was orange but I restarted the program and my computer and now it only stays red. When I click on the start service for Apache and a could not execute menu item (internal error) [Exception] Could not perform service action: The system cannon find the file specified and in the top bar it says Aestan Tray Menu..Now I dont have skype the services all mentioned above are not on on my computer and everything worked perfectly a few hours ago so I am at a standstill. My httpd.conf file is set to listen on *:80 but I changed just to see if it would work. Now I dont believe that it is an issue with these files because the system doesnt seem to even remotely try and run. If you can, please help!!! Because I don't know where else to go and I am not trying to reinstall the program because I have done a lot of work with wordpress and the routing to get it to my domain, and if it is a corrupt file I can't copy them obviously...Thanks!!!

    ReplyDelete
    Replies
    1. Hey James, well your problem seems a bit more complex. Is it possible that you let me connect to your computer via TeamViewer? I'll try my best to resolve your issue

      Delete
  52. I tried going through the steps and it worked as expected. Excellent

    ReplyDelete
  53. hi dear
    I read a lot of columns and did all but I did not get solution.i have orange icon problem.i changed port and various things.i have freshly installed window 8 and I do not any program in my system other than this wampserver.kindly help me.

    ReplyDelete
  54. the problem you mentioned is about offline problem....just click on the wamp icon and click on the last option saying 'go online' ......then server goes online...
    it works :)

    ReplyDelete