Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

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?

share|improve this question
    
Could you please specify what file type it is chrome is downloading? – Octavian 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.

share|improve this answer
    
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 '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

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.

share|improve this answer
    
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

 
discard

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.