display_errors值不是';t在phpinfo()中更改


display_errors value isn't changing in phpinfo()

我需要关闭PHP中的display_errors。我更改了php.ini(/usr/local/php5/lib/php.ini)文件。

还使用phpinfo()确认正在更改正确的文件:加载的配置文件-->/usr/local/php5/lib/php.ini

我在php.ini中将display_errors改为"关闭"。但是phpinfo()中display_errors的值不会改变:本地值和主值的display_errors On。

php.ini中的值:

; display_errors
;   Default Value: Off
;   Development Value: Off
;   Production Value: Off
; display_startup_errors
;   Default Value: Off
;   Development Value: Off
;   Production Value: Off
; error_reporting = 0
;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;   Development Value: E_ALL
;   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

我玩了大约两个小时。任何帮助都会很棒。谢谢

是否删除了前面的分号?

display_errors = Off
;   Default Value: Off
;   Development Value: Off
;   Production Value: Off
display_startup_errors = Off
;   Default Value: Off
;   Development Value: Off
;   Production Value: Off
error_reporting = 0
;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;   Development Value: E_ALL
;   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

分号是php.ini 中的注释

; display_errors
;   Default Value: Off

之后的一切;被忽略。

请注意,您在问题中显示的部分位于类似的标题下方

;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.
; display_errors
;   Default Value: On
;   Development Value: On
;   Production Value: Off
; display_startup_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: Off
; error_reporting
;   Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
;   Development Value: E_ALL
;   Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

本节仅用于文档,而不是实际参数所在的位置。如果你在文件中往下看,你会看到真实的参数位置

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; For production environments, we recommend logging errors rather than
; sending them to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = On

这是您应该对实际参数进行更改的地方,因为如果更改您提到的部分,参数更改将被下面指定的real参数覆盖。

另外,不要忘记在保存对php.ini的任何更改后重新启动Apache,否则这些更改将不会生效。