Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

3 Answers 3

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

I have exactly the same strange behaviour here on a local debian webserver running up-to-date apache2.

Mozilla and even IE are behaving well, but new shooting star Chrome just downloads the page as text. Occurs only when the link ends with a slash (so the DirectoryIndex-File is automatically served), i.e. http://intranet/

When i type http://intranet/index.php, the page displays fine... i have tried both URL-calls with wget, and the output and content-type is EXACTLY the same!

What's wrong here? Is it just me or is it Chrome?

share|improve this answer
    
I’ve also seen this issue, but only happen sometimes for me... What version of Chrome do you use? Maybe we need to search for upstrem bug reports on this, or file a new bug against Chrome. –  Fitoschido Sep 21 '11 at 16:41

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.