Search code examples
phpconfiguration-fileserror-reportingphp-ini

Disable logging PHP Notices into php.log file (php.ini)


I have a situation on my server, my log files are taking up too much space and I see that there are a lot of warnings that are being logged. I would want to disable notices logging for now and keep the disk space under check.

The change I added onto php.ini file was:

error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR

I restarted my apache and zend but I still see that notices are still being logged into the php.log file.

Please let me know if there is something else that I need to configure.


Solution

  • // Report all errors except E_NOTICE
    error_reporting(E_ALL & ~E_NOTICE)
    

    You can read more at:

    http://php.net/manual/en/function.error-reporting.php