IE trying to download all PHP files?

I left my website alone for a while, and have come back every so often in my browser of choice (Firefox) to make sure everything looks OK. I just got a call from a friend who said my entire site is down. He’s using IE. So I fired up IE and sure enough, IE is prompting a download for every PHP page I’ve tried accessing. Here is the message of the prompt:

Internet Explorer

File Download
======================================
Do you want to open or save this file?

Name: file.php
Type: Unknown File Type, 8.55 KB
From: www.mysite.com

OPEN | SAVE | CANCEL

[x] Always ask before opening this type of file
==============================================

While files from the Internet can be useful, some files can
potentially harm your computer.  If you do not trust the source,
do not open or save this file.  [U]What's the risk?[/U]

I don’t even know where to begin troubleshooting this. If you have any advice, please let me know! Thank you in advance.

hmm, that usually happens when the server isn’t running PHP.

This is usually down to a missing/bad AddType handler for php files.
Check Apache’s httpd.conf file for a lines like:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Also make sure there’s a line like:

LoadModule php5_module /usr/lib/apache/1.3/libphp5.so

Crap. Safari is showing the same behavior. It is trying to download all PHP files just like IE Win. Things work normally in Firefox, Opera, iCab, Mac IE 5 so far.

If you host this site from your own PC or a dedicated server, I would check that Apache (httpd.conf) is setup to pass execution of PHP files to PHP. If this site is on shared hosting or hosted by a company rather than yourself it sounds like they are experiencing problems with their server. I’d get in touch and find out what is happening to cause this loss of service.

Thanks for the help. It is not my own server, and I don’t have access to the httpd.conf. I have contacted the company and they are “looking into it.” It seems really strange that this would only effect certain browsers…

post the http response headers of a problematic page.

you can use this tool(use the tool in IE)

or you can use the http live headers extension for firefox to view the headers.

what is the contents of the file that it downloads? is it the html output, or the php source code?

Hi all,

Thank you for all of the help. The issue was indeed with the server and is now resolved. I didn’t have a chance to view the headers before it was fxed. I would’ve liked to check that in order to hopefully help any forum readersa in the future that may have this problem. The problem was in the php.ini file (on the server’s config, not one of my own)

There was a value of:

default_mimetype = texthtml

that needed changing to:

default_mimetype = "text/html"

I hope this helps someone down the road. Thanks again all.

Sometimes object buffering and/or gz_compression can cause this.
Do you use compression on your pages?

none that I’m aware of unless the server automatically is doing it.