Adjusting PHP-FPM Error Reporting to ignore NOTICE
There are similar posts and threads around the web, but this is slightly different.
Even though I run CloudLinux, I do NOT use PHP Selector. I only run EA-PHP packages from cPanel.
I would really like, for example - /opt/cpanel/ea-php83/root/usr/var/log/php-fpm/error.log - to stop logging NOTICE and only log WARNING or higher.
According to all of the documentation I have read - and I apparently I'm reading it all wrong - the proper way to do this is via WHM > Software > MultiPHP Manager > Manage Settings and set the Error Reporting option to:
E_ALL & ~E_NOTICE
Well, that's how it is set. Yet my /opt/cpanel/ea-phpXX/root/usr/var/log/php-fpm/error.log files are still filling up with thousand of lines like this:
[12-Aug-2024 20:12:14] NOTICE: [pool example_org] child 206961 exited with code 0 after 150.393338 seconds from start
[12-Aug-2024 20:12:14] NOTICE: [pool example_org] child 208944 started
[12-Aug-2024 20:12:34] NOTICE: [pool example_com] child 207028 exited with code 0 after 156.153223 seconds from start
[12-Aug-2024 20:12:34] NOTICE: [pool example_com] child 209020 started
[12-Aug-2024 20:12:37] NOTICE: [pool example_com] child 207026 exited with code 0 after 159.177633 seconds from start
[12-Aug-2024 20:12:37] NOTICE: [pool example_com] child 209028 started
I'm tempted to change E_ALL & ~E_NOTICE to E_ALL & ~E_WARNING , but that would seem to contradict with everything I have read in articles and posts.
Can someone please tell me what I'm missing or doing wrong?
Thank you for any guidance!
-
Hey there! No, you're definitely setting the value correct, but I think there's some confusion on what exactly is being logged.
When you make the change to use E_ALL & ~E_NOTICE you are keeping *domains* from logging that information to /home/username/logs/domain.com.error.log (or whatever your particular local PHP log file is). What you're seeing in /opt/cpanel/.........error.log is the logs for the PHP-FPM daemon process itself, and even though they show up as NOTICE in that log file, those system logs aren't going to be suppressed.
Is that log file in /opt getting unusually large on your system?
0 -
Thank you very much for the clarification!
And to answer your question - I don't think the /opt/cpanel/ea-php83/root/usr/var/log/php-fpm/error.log files are unusually large (around 2MB to 4MB , but still pretty big for text files) , and filled with so many non-stop notices while I'm trying to troubleshoot PHP-FPM issues that are affecting my customers, that I wanted to quell it.
I was able to quiet the log down by editing /opt/cpanel/ea-php83/root/etc/php-fpm.conf and changing log_level = notice to log_level = warning (and of course restarting phpfpm), and have now switched it back.
Thank you again for the clarification / distinction between the setting and entries for /home/username/logs/ error log and the system's PHP log!
0 -
Sure thing! And, I'll admit, it took me a while to figure this one out too :D
0
Please sign in to leave a comment.
Comments
3 comments