开发者

PHP - 500 instead of error

开发者 https://www.devze.com 2023-04-02 15:19 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消