I have apache directives set up for custom error docs for 404, 403, etc, as well as 500. However, PHP, upon encountering a fatal error, displays a blank page instead of triggering the apache 500 response.
I don't need to display the error details or anything like that, as they are currently logged correctly in apache error_logs, so I don't think it has anything to do with error_reporting or display_errors, both of which are set correctly.
There are some similar questions here on SO, but haven't found an answer that does what I need. Basically, in the case of something like a syntax error, I want to see the apache 500 error page, NOT a blank page. This is not something that can be caught and handled in PHP, since syntax errors are uncatchable.
This appears to have been patched/fixed in php 5.2.4, as seen here: http://www.mail-archive.com/[email protected]/msg28557.html
However, we are using PHP 5.2.17, and an upgrade is not feasible at this time. Does anyone have any solutions / workarounds that might work to trigger 500 errors in apache for any PHP syntax/fatal error?
Not sure if this works: register a shutdown handler and display the appropriate page. The shutdown handler should get called whenever a fatal error occurs. Make sure that you register the handler on top of your script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With