Reputation: 539
I am using wamp for few years and i upgraded to windows 8 few months before, my wamp working smoothly up to yesterday. But now it can't be accessed using localhost. but when i trying 127.0.0.1 instead it works smoothly. I changed ::1 localhost to 127.0.0.1 localhost in host file. which where the solution suggested for this problem in most websites. But unfortunately its not work for me. When i ping localhost its showing replay from ::1: time<1ms. And There is no software's using port 80 i already checked it. please help to solve this.
Upvotes: 12
Views: 63139
Reputation: 25553
Mine is Ubuntu 20.04 VM
I had this following line.
::1 localhost ip6-localhost ip6-loopback
I commented that line and added the following line.
::1 ip6-localhost ip6-loopback
Basically removed
::1 localhost
It now works.
The final look of the hosts file is as follows.
127.0.0.1 localhost
127.0.1.1 vagrant.vm vagrant
# The following lines are desirable for IPv6 capable hosts
#::1 localhost ip6-localhost ip6-loopback
::1 ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.2.1 w1 w1
Upvotes: 4
Reputation: 1
This issue also arises if you edited your vhosts.conf file and added a virtual host. To resolve comment out every line of the virtual host entry, e.g. If using xampp, edit your entry in vhosts.conf and comment all the lines (add an # before each line)
##<VirtualHost *:80>
##ServerAdmin [email protected]
##DocumentRoot "E:/xampp/htdocs/dummy-host.example.com"
##ServerName dummy-host.example.com
##ServerAlias www.dummy-host.example.com
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>
then un-comment or add 127.0.0.1 localhost
in your hosts file.
Upvotes: 0
Reputation: 577
You can remove comment (# row start) or add 127.0.0.1 localhost In your hosts (folder etc)
Open this file with privilege admin
Upvotes: 0
Reputation: 93
Resolved Issue by editing /etc/hosts file: I also had similar issue(Able to ping 127.0.0.1, but issue while pinging localhost). I resolved it by removing entries like ::1 localhost, ff81::1%lo0 localhost with only 127.0.0.1 localhost.... I removed rest of the entries for localhost. I done this for my mac.
After this process I can debug my java application using eclipse.
Upvotes: 0
Reputation: 59
After adding the line 127.0.0.1 localhost to the hosts file, copy the contents of hosts file and paste it in another new file, then replace the old hosts files with the new one. This worked for me.
Upvotes: -1
Reputation: 415
For DNS problem:
ipconfig /flushdns
ipconfig /registerdns
or rather backup the code and reinstall the wamp server.
Much faster solution however remember you're wamp settings.
Upvotes: 0
Reputation: 99
I ran into the same problem with XAMPP on my Mac and (finally) figured out how to fix it. Something similar might work for you on Windows:
Even though my /etc/hosts file looked correct, I had a feeling it wasn't working. ("ping localhost" returned no results, but "ping 127.0.0.1" was working.) So, I found that there was a copy of the original hosts file (/etc/hosts~orig) which I replaced my current hosts file with. That did the trick after restarting Apache.
$ sudo mv /etc/hosts /etc/hosts~old
$ sudo cp /etc/hosts~orig /etc/hosts
$ ping localhost
Upvotes: -1
Reputation: 11832
Add 127.0.0.1 localhost
to your hosts file.
If there is a #
(comment sign) in front of it, remove it.
Remove other instances of localhost, or place a #
in front of those other instances.
Your hosts file is usually in c:\windows\system32\drivers\etc\hosts
, and when you try to edit this file run notepad (or any other preferred editor) as ADMINISTRATOR, otherwise chances are big your modifications wont be saved.
After doing all this, in your browser do a control-f5 (refresh without using the cache).
Upvotes: 0
Reputation: 1002
Edit
%SystemRoot%\system32\drivers\etc\hosts
and replace
::1 localhost
with
127.0.0.1 localhost
Save and restart apache. Hope it will work .
Upvotes: 1