2

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?

2
  • Could you please specify what file type it is chrome is downloading? Mar 2, 2011 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, 2011 at 21:45

2 Answers 2

2

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.

2
  • my output is --2011-03-03 17:42:47-- localhost Resolving localhost... ::1, 127.0.0.1, 127.0.0.1 Connecting to localhost|::1|:80... failed: Connection refused. Connecting to localhost|127.0.0.1|: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, 2011 at 12:18
  • The /* something */ may provide a clue too; could you edit your question and add this info? Mar 3, 2011 at 23:30
1

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

info.php

<html>
<head>
<title> PHP Test Script </title>
</head>
<body>
<?php
phpinfo( );
?>
</body>
</html>

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.

2
  • 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, 2011 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. Mar 3, 2011 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .