views:

339

answers:

2

For my development environment I recently moved to PHP 5.3 w/ fastCGI on IIS from php 5.2 w/ ISAPI on IIS and when I have an error (such as function name is incorrect) I'm used to PHP reporting back FATAL ERROR etc... to the browser. Intermittently instead of receiving the error I receive a HTTP 500. If browsing with firefox this does not occur.

It seems to be related to IE caching content-type or HTTP code something like that. My reasoning is that if I eliminate the chunk of offending code and refresh the page (in IE) and then place the offending code back in I will see the error message.

Does anyone know what I should look at?

display_errors is set to On....

Tried to add code in comments and it was ugly so i'm appending:
Sample Code: index.php <?php php_infowrong(); ?>

If I type in the URL of the website I get:

On Firefox I receive: PHP Fatal error: Call to undefined function php_infowrong() in D:\Web\pathtowebsite\index.php on line 2

On Internet Explorer I receive: HTTP 500 Internal Server Error

If I then change the index.php to <?php phpinfo(); ?> Then both IE and Firefox give the correct php_info page.

If I change the index.php back to it's original erronous form and refresh the page THEN IE will show: PHP Fatal error: Call to undefined function php_infowrong() in D:\Web\pathtowebsite\index.php

A: 

Can you try this setting in header? header("HTTP/1.1 304 Not Modified");

http://stackoverflow.com/questions/966204/bizarre-bug-when-trying-to-use-http-caching-headers-from-php

Satish
well the issue comes in only when their is an error in the code.... are you recommending I output that header() on all responses just in case the code may later generate an error? the referenced question didnt seem to address the same issue.
Ben Reisner
+2  A: 

I don't know if this applies to IE7 but previous versions of IE had this "feature" where the browser would substitute its own error page if the one returned from the server was too short. I found this in the MS Knowledge Base, seriously ancient (IE4!), but might be worth a look.

Ken Keenan
That's correct. You need to pad errors out to 512 bytes, or click Tools / Internet Options / Advanced and untick "Show Friendly Errors."Use Fiddler, and you'll see that the same HTTP/500 is going back to both browsers.
EricLaw -MSFT-