Jonathan
Jonathan

Reputation: 986

PHP: 500 Error to error page

As a prelude, I know what a HTTP 500 is, and I know how to fix them.

On PHP 5.3, i'm running a production environment with show_errors off. When there are any fatal errors, the user gets a plain white 500 page in response. I'm trying to create a 500 error page just in case there any any errors; just so it is more user friendly.

I used to be able to do

ErrorDocument 500 500.html

It doesn't seem to be working anymore, however - even thought my 404

ErrorDocument 404 404.html

Works fine.

Curious to see solutions regarding this - Thank you for your time.

Upvotes: 1

Views: 1078

Answers (1)

Mike Brant
Mike Brant

Reputation: 71384

Fatal errors don't produce 500 errors in and of themselves, they would return 200 with blank page typically (if no output had been flushed to browser at the point of the error) . Plus this will not help you anyway, as Apache would be no longer involved when PHP is having the error.

Maybe you could register a shutdown function to send 500 header (to get 500 result) and display the content you want to display.

Upvotes: 3

Related Questions