I'm trying to not log notice errors, which are being written to an error log file on my server. I've tried (at the top of my index.php
):
ini_set('display_errors', 0);
error_reporting(E_ALL ^ E_NOTICE);
But I'm still getting PHP notice errors in said error log file.
I'm on a shared hosting environment, so I can't edit my php.ini
file.
phpinfo()
tells me:
- Version 5.2.12
- error_reporting 6143
- error_log error_log
- safe_mode Off
Are you getting Notice's or "USER" Notice's in your log?
To disable both use:
you can change the error reporting level to something different
error_reporting(E_ERROR | E_WARNING | E_PARSE);
see http://www.php.net/manual/en/function.error-reporting.php for more information
Try doing:
The
error_reporting()
directive will always works (PHP_INI_ALL
).Are you sure you're not including any library that changes your error reporting level?
Do
error_reporting(0);
and then do this:What is the output?
If you're on an Apache server, try setting the value in a .htaccess file. The general format is:
where
integer
is the value you get from running something like:More info here:
http://perishablepress.com/press/2008/01/14/advanced-php-error-handling-via-htaccess/