Rectangle 27 0

Apache ErrorDocument not working for PHP 500 error?


I don't believe Apache will let you run PHP files for 500 errors because the error page could generate an error. Try rendering out your 500 error to an HTML file and point your directives at that.

Thanks for the suggestion but using a .html file makes no difference, the browser still receives a 500 response and no content.

Note
Rectangle 27 0

Apache ErrorDocument not working for PHP 500 error?


You may need to add the ErrorDocument declaration earlier in the Apache conf chain. If you add this to a vhost conf it may not be called.

Note
Rectangle 27 0

Apache ErrorDocument not working for PHP 500 error?


ErrorDocument 500 /errorpage.php?error=500

,I read loads online about the same where some people claim that this solved their similar issue, others say that it wouldnt help as Apache has handed over the control to PHP.Maybe some php code is setting Headers to 500 and that would probably lead to the browser displaying its custom 500 error message.

I happened to encounter the same issue while working with codeigniter and Imagick. imagick was setting a 500 HTTP error when something went wrong and in that case Codeigniter's custom 500 message was not displayed.

I resolved this by adding try-catch to all Imagick functions.Check that where from the 500 issue is arising and then add a try-catch there.As for

Note