I set up Apache web server.

When I open http://localhost in Google Chrome, it asks me to download a file. It works correctly with Firefox.

How can I resolve this issue?

  • Could you please specify what file type it is chrome is downloading? – Octavian A. Damiean Mar 2 '11 at 10:48
  • I have the exact same issue. Going to "localhost:8888/folder" triggers a download (extensionless file name 'download'). It's a php file, but it's processed, so php works properly. – joon Mar 16 '11 at 21:45

Sounds like your server is sending a Content-Type header that Chrome thinks it should download, rather than display.

You can check for this with:

wget --server-response -O /dev/null http://localhost/

which should display the headers that the server is sending.

  • my output is --2011-03-03 17:42:47-- localhost Resolving localhost... ::1,, Connecting to localhost|::1|:80... failed: Connection refused. Connecting to localhost||:80... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK /*something*/ Content-Type: text/html Length: 517 [text/html] Saving to: /dev/null' 100%[======================================>] 517 --.-K/s in 0s 2011-03-03 17:42:47 (59.8 MB/s) - /dev/null' saved [517/517] – Parimal N Mar 3 '11 at 12:18
  • The /* something */ may provide a clue too; could you edit your question and add this info? – Jeremy Kerr Mar 3 '11 at 23:30

You are probably needing to install php or it is not running at the time that you wish to open a PHP file.

If this is the case, first make sure everything is OK in your PHP config by running the next in a php file which you can name info.php and calling it like localhost/info.php when placed in your localhost root folder, usually /var/www


<title> PHP Test Script </title>
phpinfo( );

The result should be like this:

enter image description here

If you are receiving issues in your php config you first try to fix it, and if you receive an info.php file download then you should first install php support in your system, which can easily be achieved via synaptic.

  • hey thanks that helped, but still when i type localhost/index.html my page gets opened in chromium and firefox but if i type only localhost it asks me to download a file named download, this is not the case with firefox – Parimal N Mar 3 '11 at 12:16
  • Do you mind posting the contents of your index.html in order to see if it is pointing to a file download instead of the execution of html code? Additionally, check file permissions in order to see if it is having 755, which may affect the behavior of your index.html file. – Geppettvs D'Constanzo Mar 3 '11 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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