PHP 脚本中不显示错误
我已经尝试使用这些代码:
error_reporting(E_ALL^E_NOTICE);
ini_set("display_startup_errors","on");
ini_set("track_errors","on");
ini_set("error_reporting","E_ALL^E_NOTICE");
但我的脚本上仍然没有出现错误。发生任何错误时它只显示空白屏幕。请指导我。
I have tried with these code:
error_reporting(E_ALL^E_NOTICE);
ini_set("display_startup_errors","on");
ini_set("track_errors","on");
ini_set("error_reporting","E_ALL^E_NOTICE");
But still errors are not appearing on my script.It just displaying only blank white screen when any error occur.Please guide me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能是您的提供商已将 PHP 错误设置为不输出,而是在内部记录。我以前也经历过这样的事。在这种情况下,自定义错误处理程序可能会帮助您。不过,在此之前,请确保任何语句前面都没有@,并且 log_errors 已打开。还可以运行
phpinfo()
来仔细检查是否所有报告设置都已激活。此外,完全空白的页面可能是结构解析错误。使用像第一个这样的简单的引发错误的语句进行检查
。
It could be that your provider has set PHP errors not to be output, but logged internally. I have experienced this before. In that case, a custom error handler may help you. Before, though, make sure you have no @s in front of any statements and log_errors is on. Also run a
phpinfo()
to double-check whether all reporting settings are activated.Also, a completely blank page could be a structural parse error. Check with a simple error-inducing statement like
first.
怎么样:
?
how about:
?
这是在你自己的服务器上吗?或者共享托管等?错误报告可能在服务器级别被关闭。 (原因通常是“安全”,但我不明白这实际上是一个安全问题。)
如果您有权访问它,请编辑您的服务器配置(
php.ini
),或者联系您的主机。他们也许能够提供对错误日志的访问。Is this on your own server? Or shared hosting etc? It's likely that error reporting is turned off at the server level. (The reason is usually 'security' but I don't see how it's really a security issue.)
Either edit your server config (
php.ini
) if you have access to it, or contact your host. They may be able to provide access to error logs.