PHP 不显示任何类型的错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2648533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 07:12:37  来源:igfitidea点击:

PHP doesn't show any kind of errors

phpapache

提问by iSenne

I have a PHP server at home for development. It is running:

我在家里有一个 PHP 服务器用于开发。它正在运行:

Ubuntu 9.10
Apache 2.2.12
PHP 5.3.2-0.dotdeb.1
MySql 5.0.7-dev

Currently the settings in the php.ini for displayiong errors are:

目前 php.ini 中显示错误的设置是:

display_errors = on
error_reporting = E_ALL

But I do not see any errors in my php script. Also very strange is that phpinfo() shows me this:

但是我在我的 php 脚本中没有看到任何错误。同样很奇怪的是 phpinfo() 向我展示了这个:

display_errors Off

I checked the php.ini file, and restarted the apache server many times, but with no luck. Does anybody knows how this is possible?

我检查了 php.ini 文件,并多次重新启动 apache 服务器,但没有运气。有谁知道这怎么可能?

edit:
When I localy set this:

编辑:
当我在本地设置时:

ini_set('display_errors', 'on');

I do receive errors.

我确实收到错误。

回答by thetaiko

Is the display_errorsparameter listed more than once in your php.ini file? If its defined more than once, the second instance of it will override the first.

display_errors参数是否在 php.ini 文件中多次列出?如果它定义了多次,它的第二个实例将覆盖第一个。

回答by Powerlord

Ubuntu keeps separate copies of the php.ini file for each type of PHP installation.

Ubuntu 为每种类型的 PHP 安装保留 php.ini 文件的单独副本。

I'm not familiar with the dotdeb release, but I'd guess it'd be in /etc/php5/apache2/php.ini

我不熟悉 dotdeb 版本,但我猜它会在 /etc/php5/apache2/php.ini

Edit: Since this is apparently not the case, try restarting Apache. PHP won't pick up changed settings until you do.

编辑:由于这显然不是这种情况,请尝试重新启动 Apache。PHP 不会选择更改的设置,直到您这样做。

回答by IG-

Enable the following settings as shown below

启用以下设置,如下所示

display_errors

Default Value: On

Development Value: On

Production Value: Off

error_reporting

Default Value: E_ALL & ~E_NOTICE

Development Value: E_ALL | E_STRICT

Production Value: E_ALL & ~E_DEPRECATED

显示错误

默认值:开

开发价值:开

产值:关闭

错误报告

默认值:E_ALL & ~E_NOTICE

发展价值:E_ALL | E_STRICT

生产价值:E_ALL & ~E_DEPRECATED

Restart apache server

重启apache服务器