As the title indicates, I am going to share with you what I had to do just yesterday after installing WAMP Server on my laptop where I run Windows 7 Beta Operating System. Honestly I never experienced this kind of trouble ever before but strange things happen regularly as we face technology on our day-to-day basis.

A little story first. I had WAMP services all running smooth and sound, however, whenever I typed http://localhost on any browser in my system, it returned a Page Not Found result. I was still able to access my local web server using 127.0.0.1, but then when it came to loading WordPress locally, no stylesheet was loaded and the page layout was totally naked. I may just assume that could also be tweaked by altering WordPress address (URL) in Admin –> Settings –> General page, but I preferred the standard approach so I had to dig deeper. If you ever happen to encounter the same issue then keep following me till the end of this explanation.

In every Windows OS there are two files, one called lmhosts.sam and the other hosts, lying deep inside C:\Windows\System32\drivers\etc folder. Of course that differs for Windows NT editions, simply replace C:\Windows with C:\WINNT. Now lets get back to our task. I needed to tell Windows to consider localhost as I’d have entered 127.0.0.1 on the address bar. Hence I went and opened the hosts file in Notepad (you can use any text editor for this). All you have to do to fix the problem is go to the end of hosts content and make sure whether there is a line like this

127.0.0.1               localhost

If false, then type that in, just be sure to leave a space between the 127.0.0.1 address an localhost.

For some particularly strange reasons, after I did that WAMP still hesitated to work. So I pasted that into lmhosts.sam file too and the spell was gone.

Note: Keep in mind that normally these two files should already be configured by default once you install Windows, but this case is specific to Windows 7 Beta, therefore it’s not that strange to not be that way.

Did you experience such a problem? Were you able to fix it? Tell me your story, I’d be glad to read it.

Random Titles

11 responses


Do you want to comment?

Comments RSS and TrackBack Identifier URI ?

Hello,

I’ve read your post about fixing the localhost problem on windows 7 beta, but unfortunately it doesn’t fix my problem.

The Hosts file has the line #127.0.0.1 localhost, so does the lmhosts (after i’ve edited it) but still i can access my localhost only by typing 127.0.0.1

Maybe i’m doing something wrong?

I’m looking forward to your reply.

S.

March 24, 2009 8:01 PM

Saulius, I guess you have to add a new line with the 127.0.0.1 localhost and make sure it doesn’t have a ‘#’ in the beginning. That is used to comment a line, so basically the system will ignore it as it consideres that a comment and doesn’t interpret that.

After that reboot it may just be worth doing sometimes.
Let me know if you manage to come out right with it. ;)

March 24, 2009 9:46 PM

Thank you very much, from Chile

fix my problem.

April 26, 2009 9:52 PM

marcelo reading your comment just made me happier. Glad this helped.

April 28, 2009 5:14 PM

This has fixed my problem as well.

Thanks buddy.

May 7, 2009 10:18 PM

I install Skype and change lmhosts.sam . wamp and localhost come. Then rechange lmhosts.sam. but all are ok. please tell me how are skype worked?

May 22, 2009 3:52 PM

@Meshach I’m glad, you’re welcome.

@sumon when you have Skype running and then you lunch WAMP, the Apache service won’t start successfully, that because Skype takes ownership on Port 80 which is the default port for the HTTP protocol that Apache uses.
In such case, you either shut down Skype, and restart WAMP Services, or you have to manually edit the Apache configuration file called httpd.conf which can be found in this path: C:\wamp\bin\apache\Apache2.2.11\conf

Hope that helps.

May 25, 2009 12:52 PM

This fix my problem, thaks a lot for your information from Mexico
Regards

June 26, 2009 2:25 AM

Thanks so much! I was going crazy over this, and this was the only website I found with a clear answer! Nice work!

I only had to add it to the hosts file btw.

If Wamp wont fully restart, make sure Skype is fully turned off before starting Wamp.

July 9, 2009 10:27 PM

Thanks Arian! WAMPSERVER 2.0 works now in my Windows 7 Beta.

July 20, 2009 4:20 AM

the interface of Windows 7 is great but in my opinion Windows XP is still a very solid and stable operating system. Right now, I would never give up XP for Windows 7.

July 30, 2009 12:10 PM

Comment now!
















Trackbacks