问题描述
所以我有 xampp 并且这个东西根本不会报告任何东西......我什至强制一个错误并且它没有做任何事情......
So I have xampp and the thing won't report anything at all... I even forced an error and it didn't do anything...
我用过
error_reporting(-1);
ini_set( 'display_errors', 1 );
根据本文档 http://php.net/manual/en/function.error-reporting.php
也 error_reporting(E_ALL);
也不做任何事情......
also error_reporting(E_ALL);
doesn't do anything either...
推荐答案
您可能没有收到任何简单"错误,例如:
Probably you're not getting any 'simple' errors like:
Parse error: syntax error, unexpected T_VARIABLE in .../.../index.php on line 6
#or
Warning: include(whateveryouwantedto.include): failed to open str(...)
但你确实得到了类似的东西:
But you do get things like:
Fatal error: Call to undefined method stdClass::Crap() in .../.../index.php on line 6
根据我的想法,这是因为如果您不在 PHP 配置中禁用日志记录,简单"错误将无处"发送.换句话说:PHP 通过不显示任何错误来帮助"您,因为您定义了 log_errors = On
和/或 error_log = 'php_errors.log'
并且它正在记录所有'真正的'错误,但你的只是不把它削减到'真正的'类别.
According to my thinking hat, this is because if you don't disable logging in your PHP configuration the 'simple' errors will be sent 'nowhere'. In other words: PHP is 'helping' you by not showing any errors because you either defined log_errors = On
and/or error_log = 'php_errors.log'
and it's logging all 'real' errors but your's just don't cut it to the 'real' category.
如果这没有帮助,思考帽会说:它不记得了,但我确信它在 PHP 或 Apache 配置中的某个地方."
If this doesn't help, the thinking hat says: "It can't f* remember, but I sure as heaven/hell know it is somewhere in the PHP or Apache config."
当然希望我的思考帽能帮到你.
Sure hope my thinking hat helped you out.
解决这个问题可能是找到并打开 php.ini,全选,删除/退格,保存(但保持打开)(或在某处保存副本).然后重新启动 Apache.看看有没有区别.如果是这样,则 php 配置在其他地方.恢复 php 文件并从根目录搜索您的计算机或服务器以查找另一个 php.ini.
Tackling this problem might be to find and open php.ini, select all, delete/backspace, save (but keep open) (or save a copy somewhere). Then restart Apache. See if there's any difference. If so, the php configuration is somewhere else. Restore the php file and search your computer or server from the root up for another php.ini.
另外我认为你应该确保:
Also I think you should make sure :
log_errors = Off
error_log = "./"
display_errors = On
error_reporting = E_ALL
或者在 PHP 中:
error_reporting(E_ALL & E_STRICT);
ini_set('display_errors', '1');
ini_set('log_errors', '0');
ini_set('error_log', './');
这篇关于打开错误报告 xampp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!