简体   繁体   中英

Why is error_reporting being ignored in php.ini?

I have set error_reporting = none in /etc/php5/apache2/php.ini and ran sudo service apache2 restart yet when I tail /var/log/apache2/error.log I still get stuff like PHP Notice:xxxxxxxxxxxxx showing up.

Why is this?

You should assign 0 rather than none to the error_reporting parameter in your php.ini:

error_reporting=0

The error_reporting parameter value is an integer bitmask where each bit represents different error level. 0 means all error levels are off, including notice.

You can also override default error_reporting value in your individual PHP script by using the following statement:

ini_set('error_reporting', 0);

This will turn all error reporting off for the current script's execution only.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM