PHP-500而不是错误
问题描述:
我有一个用PHP编写的页面.我无权访问服务器.我想这样做,而不是在PHP遇到错误时显示错误消息,而是给出500.
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.
答
如果display_errors已关闭,则默认情况下,PHP 5.2在发生致命错误的情况下会发送HTTP 500. 如果托管使用较旧的PHP,则必须注册自己的错误处理程序,并可能注册
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.