Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Trying to get a client's site up. The HTML files keep downloading rather than executing.

I've done a MIME check and the files appear to be text/html. I recreated the database admin, password and made sure that there was a connection between the script and the MySQL database. Permissions seem to be fine and the index.html is executable, permissions 755. Not sure where to turn next.

share|improve this question
2  
"I recreated the database admin..." - have you tried this without any "database" and a simple test.html file? By "download", presumably you mean you are prompted with a "Save As..." dialog? "index.html is executable, permissions 755" - "index.html" should not be executable and neither should it be 0755 - those are the permissions you would perhaps expect for an internal directory. –  w3d Feb 23 at 0:11
    
Can you tell us the procedure you did when doing the MIME check? I suspect your checking the config file in a text viewer when that's fine but it doesn't necessary mean that the config is being read. Have you done a PHP Info check? –  bybe Feb 23 at 12:04

1 Answer 1

When a web browser offers to download a file rather than open it, it is generally because the headers are incorrect. It sounds like you already checked the "Content-Type" header, but you also need to check the "Content-Disposition" header.

An easy way to check the headers on your page is to use the command line tool curl:

curl -s --head 'http://example.com/'

The "Content-Type" header should start with "text/html". There should be no "Content-Disposition" header. If you see something like this, you will need to configure your server to remove it:

Content-Disposition: attachment; filename="file.html"
share|improve this answer

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.