PHP - 500 instead of error
I have a page written in PHP. I do not have access to the server. I'd like to make so that instead of showing an error message when PHP 开发者_运维知识库encounters an error, it gives a 500.
PHP 5.2 by default sends HTTP 500 in case of fatal error, if display_errors is off. If the hosting is with older PHP, you have to register your own error handler and possibly exception handler and redirect the user to your 500 error page. Try setting the display_errors and error_reporting variables in your PHP script as @Umang suggested.
you can create your own error handler and use it to send 503 status code to the client.
精彩评论