PHP 脚本中不显示错误

发布于 2024-08-13 12:17:50 字数 239 浏览 3 评论 0原文

我已经尝试使用这些代码:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

掌心的温暖 2024-08-20 12:17:50

可能是您的提供商已将 PHP 错误设置为不输出,而是在内部记录。我以前也经历过这样的事。在这种情况下,自定义错误处理程序可能会帮助您。不过,在此之前,请确保任何语句前面都没有@,并且 log_errors 已打开。还可以运行 phpinfo() 来仔细检查是否所有报告设置都已激活。

此外,完全空白的页面可能是结构解析错误。使用像第一个这样的简单的引发错误的语句进行检查

ecxho("hello world");  

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

ecxho("hello world");  

first.

谁的年少不轻狂 2024-08-20 12:17:50

怎么样:

ini_set('display_errors', 1);

how about:

ini_set('display_errors', 1);

?

枫以 2024-08-20 12:17:50

这是在你自己的服务器上吗?或者共享托管等?错误报告可能在服务器级别被关闭。 (原因通常是“安全”,但我不明白这实际上是一个安全问题。)

如果您有权访问它,请编辑您的服务器配置(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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文