PHP-500而不是错误 [英] PHP - 500 instead of error

查看:76
本文介绍了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.

这篇关于PHP-500而不是错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆