Fixing XAMPP Localhost in Windows 7 Ultimate 64-bit

As a web developer, one tool that I need is local webserver. For easy setup, I choose XAMPP as the compact webserver software, because it already includes Apache (PHP Server) and MySQL Server. Based on my experience with previous OS before (Windows 7 32-bit), the problem I faced is that I couldn’t access localhost via http. What’s wrong? Because I didn’t know how that happened, I gave up with using https instead of http. For some reasons, this won’t be good to your work. But I didn’t have any other choices. But after some weeks, I didn’t know what happened and the problem was automatically fixed. I could access http://localhost again and continue to code with that address.

Several days ago, I decided to reinstall my laptop with Windows 7 64-bit, since my RAM is 4GB, which is not optimized for 32-bit operating system. Why? Because we know that 32-bit OS can only manage to approximately 3GB RAM (based on the address mapping). And another reason is the release of Ubuntu 10.04, so that I want to create a dual boot Windows 7 and Ubuntu 10.04 version 64-bit. For some reasons, I suggest that you also reinstall your OS within some periode of time.

The effect of the reinstallation, of course I had to reinstall all software inside it. Installation of the other software didn’t make any problem. I feel good with 64-bit OS, so that my laptop can run faster because all the RAM is fully used. The same problem happened as before, when installing XAMPP as local webserver. I used XAMPP 1.7.3 in my laptop. The conditions after installation are like the following points.

  • I couldn’t access http://localhost from my browser
  • I managed to access the localhost via https port
  • I managed to access it via IP (127.0.0.1)
  • When I tried to ping the localhost, it gave my PC Name but with ip “::1:” (without quotes)

What happened? From what I read from the Internet, they suggest me to resolve the IP hosts in Windows. Ok, I tried to find the hosts file that used to be in “%SYSTEM%\System32\drivers\etc”. Actually, in Windows 7 64-bit architecture, there will be 2 system folder, System32 and SysWOW64 (which belongs to the 64-bit). I tried to find in both folders, but I couldn’t find any file titled “hosts”. Not olny that, the folder “etc” didn’t exist too. Where I can change the hosts file?

After trying to search with keyword “hosts”, I managed to find other hosts file that is placed in c:\Windows\winsxs\amd64_microsoft-windows-w..nfrastructure-other_31bf3856ad364e35_6.1.7600.16385_none_6079f415110c0210\. I thought this is the hosts file in Windows 7 64-bit. But what I thought was wrong. In that file, localhost was already pointed to 127.0.0.1. And for some reasons, I add “activate.adobe.com” pointed to same IP in order to install Adobe Photoshop (just like usual “pirated” installation). But I still couldn’t access it via http port. Why?

After further searching, I found that maybe it was because of the “http.sys” Windows 7 file that also use port 80 as its service. I tried to follow the tutorial, but still can’t reach the solution. What I got from pinging localhost still the ::1:. Hm, I thought that maybe there is another real hosts file exist. But after searching using search feature in Total Commander, I couldn’t find anything.

Searching again, and I found another solution “wanna be”. And actually that is the real solution. Ok, I’ll start share it to you who faces the same problem.

Actually, Windows 7 64-bit (I don’t know whether 32-bit also or not) create another folder called Sysnative in Windows folder. The size I saw using Total Commander is E (0 bytes). I don’t know what kind of folder is it, maybe you can share to me. In that folder, there are so many folder, which are similar to the System32 folder. I tried to find hosts file in “drivers\etc“, and I managed to find that. Wow, this is the very super hidden file that can’t be find using search feature.

Yes, this is the solution of that problem. Here is the step,

  1. Right click and open the security properties of the file
  2. Click edit and choose your account (you need to be the administrator)
  3. Change your permissions so that you can edit it, and then close
  4. Open that file in any text editor
  5. Delete the line that includes “::1:”, and then remove the comment (#) from the line 127.0.0.1
  6. You can add other routes if you want, such as “activate.adobe.com” to install pirated Adobe Collection :-p
  7. Close that file, and run “ipconfig /flushdns” in cmd

With those solution, now I can access my localhost via http port. I hope this article can help you who face the similar problem. Feel free to leave a comment. 🙂

This is repost from my previous blog.

3 Comments

  1. Mas, nyerah nih gak running localhostnya mau pake xampp, wamp, udah di fixit pake MS Fixit, benerin file hosts, restart services apache,dan gak ada tuh folder yang dimaksud diatas. kalao emang bener bener ngumpet, pake apa nyarinya? Thanks. Desperate banget nih.

    Reply

Leave a Comment.