无法让PHP报告错误

发布于 2024-09-16 18:32:07 字数 415 浏览 1 评论 0原文

我看不到任何 PHP 错误。我已经尝试了所有能找到的打开错误报告的技巧,但没有任何效果。

display_errors 已打开并且 error_logging 已打开,但是当我查看任何有错误的页面时,我会看到一个空白页面。

/var/log/php.log 不存在。

如果我设置本地日志文件,则不会创建任何内容。

我一直在测试的文件

<?php
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
ini_set('error_log','script_errors.log');
ini_set('log_errors','On');


$a=

phpinfo();
?>

还有其他想法吗?

I can't see any PHP errors. I have tried every trick I can find to turn error reporting on, but nothing works.

display_errors is on and error_logging is on, but when I view any page with an error, I get a blank page.

/var/log/php.log does not exist.

if I set a local logfile, Nothing gets created.

The file I have been testing with is

<?php
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
ini_set('error_log','script_errors.log');
ini_set('log_errors','On');


$a=

phpinfo();
?>

any other ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

菩提树下叶撕阳。 2024-09-23 18:32:07

您可能需要在 .htaccess、httpd.conf 或 php.ini 中设置它(取决于您的服务器或托管公司)。您很可能遇到解析错误,这意味着您的脚本永远不会达到可以打开错误报告的程度。

You probably need to set it in .htaccess, httpd.conf or php.ini (depending on your server or hosting company). You most likely have a parse error, which means your script never gets to the point where it can turn on the error reporting.

雨的味道风的声音 2024-09-23 18:32:07

您是否尝试过编辑实际的 ini 文件而不是尝试在运行时更改它?您还可以尝试使用 ini_get('display_errors'); 来查看您的更改是否生效。如果这些都不起作用,我会说你的安装要么有问题,要么非常受限。

Have you tried editing the actual ini file as opposed to trying to change it at runtime? You can also try using ini_get('display_errors'); to see if your change took effect. If neither of those work I would say your installation is either faulty or very restricted.

月下凄凉 2024-09-23 18:32:07
  1. 在尝试任何 ini_set 选项之前,首先运行 phpinfo() 作为脚本中的第一件事。如果您的主机禁用/限制了这些 ini 函数,您很可能永远无法访问 phpinfo。
  2. 运行网络服务器的用户 ID 在运行此脚本的目录中是否具有写入权限?它可能无法打开您的测试日志文件并以这种方式终止脚本。

一旦获得 phpinfo() 输出,您将能够查看 PHP 是否/在何处记录错误。它可能会进入服务器的常规 error_log,或者完全进入其他位置。

  1. Run phpinfo() as the first thing in the script, before you try any of the ini_set options. If your host has those ini functions disabled/restricted, you'll most likely not ever get to phpinfo.
  2. Does the userID the webserver's running under have write permissions in the directory you're running this script from? It could be failing to open your test log file and kill the script that way.

Once you get some phpinfo() output, you'll be able to see if/where PHP is logging errors. It could be going into the server's general error_log, or some other location entirely.

謌踐踏愛綪 2024-09-23 18:32:07

我通过我的托管网站解决了这个问题
c面板-> php配置->显示错误

i solved this problem by my hosing website
cpanel-> php config ->display error on

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