1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

localhost is not working but 127.0.0.1 works

Discussion in 'Apache' started by 2beers, Mar 10, 2009.

  1. #1
    Hi. I have installed apache on my computer(windows vista) and works fine for almost one year on both http://localhost and http://127.0.0.1

    Yesterday i run a very slowly script in php and from then http://localhost is not working but http://127.0.0.1 is working

    I think it's a dns problem. (i've already cleared dns cache) but still the same problem.

    What do I need to to to make localhost working again?

    Thank you
    2beers, Mar 10, 2009 IP
  2. MayurGondaliya

    MayurGondaliya Well-Known Member

    Messages:
    1,224
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    MayurGondaliya, Mar 10, 2009 IP
  3. 2beers

    2beers Active Member

    Messages:
    195
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Firefox gives me the following message
    2beers, Mar 10, 2009 IP
  4. lookzovt

    lookzovt Peon

    Messages:
    38
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Looks wired. Check ping localhost.
    lookzovt, Mar 10, 2009 IP
  5. 2beers

    2beers Active Member

    Messages:
    195
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #5
    already checked

    packets sent 4 received 4 lost=0 (0%)

    it's strange for me too because until yesterday was working fine.
    Any other solution?
    2beers, Mar 10, 2009 IP
  6. gemini181

    gemini181 Peon

    Messages:
    2,883
    Likes Received:
    135
    Best Answers:
    0
    Trophy Points:
    0
    #6
    That is the type of problem I would spend four or five hours on and suddenly half of the day is gone.

    Here's what I would do:
    ((There could be better ways....))

    If you have Vista set up to frequently save restore points, and have not recently installed any important programs, then choosing your most recent restore point might be exactly what you need to get your system back to the way it was before.

    Like I said: there probably is better ways to fix it.
    gemini181, Mar 10, 2009 IP
  7. 2beers

    2beers Active Member

    Messages:
    195
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #7
    thanks gemini181 but not all the time works. I'll wait for other solutions.
    2beers, Mar 10, 2009 IP
  8. kkobashi

    kkobashi Peon

    Messages:
    41
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Check your HOSTS file to see if you didn't screw it up (duplicate lines, wrong lines, etc). It should only have this in it:
    127.0.0.1 localhost

    Check to see if its your firewall screwing things up. Turn it off and test. Turn it on and test.
    kkobashi, Mar 11, 2009 IP
  9. 2beers

    2beers Active Member

    Messages:
    195
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #9
    where can I find the host file?
    2beers, Mar 15, 2009 IP
  10. alakesh

    alakesh Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I was facing the same problem.

    Go to ->windows->system32->etc->host

    remove-> ::1 localhost
    set-> 127.0.0.1 localhost

    save and restart apache.
    Hope it will work :D
    alakesh, Mar 16, 2009 IP
  11. 2beers

    2beers Active Member

    Messages:
    195
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #11
    woow. thanks. tha works fine. but was the problem? why my host file modified?
    2beers, Mar 17, 2009 IP
  12. sm9ai

    sm9ai Active Member

    Messages:
    747
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    60
    #12
    oddly, I had exactly the same thing.

    Thanks for the solution.

    It would be interesting to know what caused it.
    sm9ai, Mar 23, 2009 IP
  13. ciscoguy

    ciscoguy Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13

    That's 127.0.0.1 expressed in IPV6

    that happens when Vista loads TCPIP protocol version 6 in Networking components.

    It does that by default, but you can uncheck it as a component.

    The problem is that apache doesn't understand IPV6

    I'm betting that ::1 was the first entry in the Hosts file, wasn't it?

    Removing all references to IPV6 is a good thing in most Redmond platforms.

    That being said, +why+ would you run Apache or any other "server" application on a desktop OS like Vista in the first place?
    It's hardly a stable sane platform for doing a website.

    Learn Linux. Centos, Fedora,Debian, Ubuntu, whatever.

    _way way way_ better of a web services platform.
    ciscoguy, Mar 26, 2009 IP
  14. 2beers

    2beers Active Member

    Messages:
    195
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #14
    ciscoguy thanks for your shared info. It really helped me.

    I'm developing a site on my local computer. And I use VIsta because sometimes I like to play some games.

    I know Linux and I know linux is much better for web platform but like I sad. I don't run my website from vista OS. Just develop them.


    Thanks again
    2beers, Mar 27, 2009 IP
  15. superjacent

    superjacent Peon

    Messages:
    98
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Slightly off-topic, but don't I feel like a prat. About an hour ago I posted a similar question which has since been answered. Anyway, will you believe me that I did in fact attempt a search. First search term "localhost to 127.0.0.1" was told that I needed at least three words to search. Next search was "configure localhost", only two words but the search continued. Nothing stood out, did check a few threads. So I posted my question.

    Only now when not specifically searching for this topic did it stand out to me.
    superjacent, Mar 27, 2009 IP
  16. dpshrek

    dpshrek Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Hi,

    I had exactly this same problem (http://127.0.0.1 working but not http://localhost in Windows Vista), and solved it as you suggested. So, big thanks!

    I had a small problem to find the HOSTS file in Windows Vista, but it is at:
    C:\Windows\System32\drivers\etc

    Then I changed the line:
    to:
    Restarted the web server, restarted the browser, and it works!! Thanks for your help.
    dpshrek, Oct 14, 2009 IP
  17. easyologist

    easyologist Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Thanks
    alakesh i was facing same problem it solved by your post
    thanks billion
    take care
    easyologist, Nov 17, 2009 IP
  18. sirpiotr

    sirpiotr Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    It works, I found the etc folder in the drivers folder under System32 as well. there was Hosts file, wich I opended with Notepad and changed the suggested line to 127.0.0.1 localhost.

    Just to clear it out as your great suggestion was still a bit difficult to follow for a novice like me :)

    Thank a lot. It works!!!:cool:
    sirpiotr, May 6, 2011 IP
  19. m0nster

    m0nster Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    restart ur apache server then re-try
    m0nster, Jun 2, 2011 IP
  20. Thirty.Grizzle

    Thirty.Grizzle Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    I was going to offer my input. I see it isn't needed
    Thirty.Grizzle, Jun 5, 2011 IP