Php 在屏幕上显示错误,但禁用文件记录
有没有办法显示PHP中的错误,但在日志文件中禁用它们 我目前有:Php 在屏幕上显示错误,但禁用文件记录,php,Php,有没有办法显示PHP中的错误,但在日志文件中禁用它们 我目前有: // Log all errors error_reporting(-1); // Display none ini_set('display_errors', 0); 另一种方法是什么?编辑文件-/etc/httpd/conf/httpd.conf 由此: CustomLog logs/access_log common ErrorLog logs/error_log 为此: #CustomLog logs/access_
// Log all errors
error_reporting(-1);
// Display none
ini_set('display_errors', 0);
另一种方法是什么?编辑文件-/etc/httpd/conf/httpd.conf
由此:
CustomLog logs/access_log common
ErrorLog logs/error_log
为此:
#CustomLog logs/access_log common
#ErrorLog logs/error_log
在
php.ini
文件中,要停止向日志文件报告错误,请关闭log\u errors=Off
; Besides displaying errors, PHP can also log errors to locations such as a
; server-specific log, STDERR, or a location specified by the error_log
; directive found below. While errors should not be displayed on productions
; servers they should still be monitored and logging is a great way to do that.
; Default Value: Off
; Development Value: On
; Production Value: On
; http://php.net/log-errors
log_errors = Off
同时确保启用了“显示错误”
; 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
这将禁用所有错误,无论是php还是apache,此外,您还将禁止访问日志:(nice;)这正是我要查找的。非常感谢。好的方面是,两者都可以使用
ini\u set()
函数进行配置