Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I view http://localhost/ in Google Chrome, it tries to download the homepage as a file, and doesn't display it. I tried http://localhost/ in Firefox 4 and it works fine.

In Chrome though, loading displays my website [which is PHP btw]. is localhost in my /etc/hosts file.

How can I make Chrome load my local website thru http://localhost?

share|improve this question
Have you tried http://localhost/? – RolandiXor Sep 13 '11 at 21:15
Try opening localhost in a different browser, does it work then? – Marco Ceppi Sep 13 '11 at 21:20
wow, weird. Ok, so first off localhost loads localhost/, and I just tried Firefox, and it works. But not in Chrome.. edited question. – Matt Sep 13 '11 at 22:42
up vote 4 down vote accepted

This actually isn't anything wrong with the browser, per se. As I suspect, you created a php file - went to run it form the browser and it downloaded. So you went off, installed php5 and mod_php5 (and various other php packages) then tried again and it failed, again, but now works! This is simply a caching issue. Chrome remembers that the last time it accessed that php file it was downloaded - so it'll keep doing that until the browsers cache is dumped.

Clear Chrome's cache and you should be good to go!

share|improve this answer
lol ouch. Thanks, it worked! – Matt Sep 14 '11 at 0:47
@Matt It's okay I've done this a lot – Marco Ceppi Sep 14 '11 at 2:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.