Stop PHP Error Notices and Warnings from being logged?
Hello,
I'm confused about configuring php error_reporting. I'm essentially using the stock configurations for php7 and php 5.6 in EA 4. Logging is happening and going to where I would expect it too, but it is very noisy.
This is what I have configured
and yet the error_log files are getting filled with lines like
How can I stop the Notices and Warnings from being logged?
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_WARNINGand yet the error_log files are getting filled with lines like
PHP Notice: Trying to get property of non-object in /home/username/public_html/wp-content/plugins/iwp-client/stats.class.php on line 441
How can I stop the Notices and Warnings from being logged?
-
You could try some of the suggestions here: ecenica.com/support/answer/disable-php-error-logs/ I probably wouldn't use the php.ini method - I think you would need to research if it was still an acceptable method to use. If you have the PHP Manager available in cPanel, you may be able to edit the php.ini file as described in : 0 -
@rpvw Thanks. I appreciate the reply. Problem is, I don't want to turn logging off, I just want to suppress PHP Notices and Warnings. I still want to log errors. I know how to edit my global (and any local) php.ini files. The issue is I believe I have the correct string for what I want logged globally, it just seems that it is being ignored. These values ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING
should be directing to not log notices, deprecated functions, strict messages or warnings, yet they appear to be getting logged.0 -
Hello @verdon, Can you verify which PHP handler is enabled for the version of PHP you are modifying that setting on? Is PHP-FPM enabled on the accounts you are testing with? Thank you. 0 -
Hi @cPanelMichael No. suphp on ea-php56 and ea-php70. ea-php70 is the default and used on most accounts. There are a couple of accounts on the server still using 5.6. PHP-FPM is not enabled at all. And here's some typical lines in an error_log file [31-Jul-2018 19:04:08 UTC] PHP Warning: Declaration of theme_navigation::update() should be compatible with WP_Widget::update($new_instance, $old_instance) in /home/username/public_html/wp-content/plugins/child-page-navigation/child-page-navigation.php on line 85 [31-Jul-2018 19:04:09 UTC] PHP Warning: Declaration of theme_navigation::update() should be compatible with WP_Widget::update($new_instance, $old_instance) in /home/username/public_html/wp-content/plugins/child-page-navigation/child-page-navigation.php on line 85 [31-Jul-2018 19:04:09 UTC] PHP Warning: Declaration of theme_navigation::update() should be compatible with WP_Widget::update($new_instance, $old_instance) in /home/username/public_html/wp-content/plugins/child-page-navigation/child-page-navigation.php on line 85 [31-Jul-2018 19:04:09 UTC] PHP Warning: Declaration of theme_navigation::update() should be compatible with WP_Widget::update($new_instance, $old_instance) in /home/username/public_html/wp-content/plugins/child-page-navigation/child-page-navigation.php on line 85 [31-Jul-2018 19:04:10 UTC] PHP Warning: Declaration of theme_navigation::update() should be compatible with WP_Widget::update($new_instance, $old_instance) in /home/username/public_html/wp-content/plugins/child-page-navigation/child-page-navigation.php on line 850 -
No. suphp on ea-php56 and ea-php70. ea-php70 is the default and used on most accounts. There are a couple of accounts on the server still using 5.6. PHP-FPM is not enabled at all.
Hello, Can you let us know the output upon running the commands below?grep error_reporting /opt/cpanel/ea-php70/root/etc/php.ini /opt/cpanel/ea-php70/root/usr/bin/php -i|grep error_reporting
Thank you.0 -
@cPanelMichael Thanks # grep error_reporting /opt/cpanel/ea-php70/root/etc/php.ini ; error_reporting error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING ; Eval the expression with current error_reporting(). Set to true if you want ; error_reporting(0) around the eval().
# /opt/cpanel/ea-php70/root/usr/bin/php -i|grep error_reporting error_reporting => 22517 => 225170 -
@cPanelMichael Thank you. Ticket ID is 10025397 0 -
RESOLVED. To follow up on this, I am grateful to cPanel support (and a little embarrassed for not thinking of it myself). It was determined that several Wordpress and WP Plugin scripts, in most accounts on the server, were actually resetting the value for 'error_reporting'. Since almost every account on the server has the same combination of WP and plugins, it seemed systematic. So, nothing at all to do with my basic Apache/PHP/EA configuration. From the googling I am doing, this may be harder to stop than it should be. It's easy to control that within .htaccess directives, but apparently not so much within actual scripts. Time for more reading :-) It may be in the end that I just use a cron task to purge error_log files from time-to-time. 0 -
Hello @verdon, I'm glad to see you were able to determine the cause of the issue. Thank you for sharing the outcome. 0
Please sign in to leave a comment.
Comments
10 comments