Stopping PHP warnings in error log files
Hi all
This may be a stupid question.
But I'm struggling with stopping the generation of PHP Warnings in the error logs, in both "logs" and the "public_html" folders at the cPanel level.
I've set the following in the server php.ini and MultiPHP Manager.
E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT & ~E_WARNING
Also note the server is setup to use the LSAPI PHP Handler.
Any help would be appreciated.
-
Where specifically did you make that change? In the Select PHP Version option inside cpanel? Inside a php.ini file? Elsewhere?
0 -
Hi mtindor
I made the changes to the php.ini server level.
WHM >> MultiPHP INI Editor >> Editor.
This was to all the php.ini files for each PHP version installed.0 -
Ok, so you are not running Cloudlinux and you are using only EA-PHP* and not alt-php* from Cloudlinux?
If that's the case, you are probably doing it right. But you might have to run a /scripts/restartsrv_apache or /scripts/restartsrv_httpd to have the new settings take place. I don't think you should have to do that, but maybe you do.
0 -
Hi mtindor
Yes, not running Cloudlinux, and only using the EasyApache version of PHP.Apache has already been restarted. And even restarted the server. But no luck.
I've only recently changed to using LSAPI PHP Handler from PHP-FPM. Could this be the cause, or is there another setting I'm unaware of.
I've not made any changes to the php/user ini files at the cPanel level.0 -
I would actually recommend fixing the errors - I wouldn't expect there to be so many warnings from PHP that it causes a problem with a log file.
There are other options you may find useful is the log is repeating the same warnings, such as the "ignore repeated errors" function:
https://www.w3schools.com/php/php_ref_error.asp
If you're doing some testing you could also disable the log_errors option in general.
0 -
Hi cPRex
We host multiple "out-the-box" WordPress sites.
These are PHP Warnings generated by themes or plugins. As the theme/plugins work, even with the warnings, it's unlikely that the developers will resolve the underlying issues any time soon.
I'm just trying to stop the error logs filling up unnecessarily.
We do have "ignore repeated errors" enabled on the primary php.ini files at the WHM. It's strange, almost like these settings are being ignored or overridden at the site level.
0 -
What happens if you make a PHP info page on the site? Do you see the error_reporting field have the correct value listed there?
0 -
The phpinfo settings shows error_reporting as 22517 (local and master).
0 -
That is E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
See here:
https://maximivanov.github.io/php-error-reporting-calculator/0 -
Error reporting levels can be changed by a PHP script.
Go to one of your worrisome wordpress site's public_html folder and do something like this ugly command line:
find . -type f | grep '\.php' | xargs grep 'error_reporting'
I chose just one random Wordpress site that I host and can see all sorts of Wordpress PHP files setting various options via the error_reporting() function.
https://www.php.net/manual/en/function.error-reporting.php
0 -
This is what I've in the WHM php.ini(s) : "error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_STRICT & ~E_WARNING". So is that correct, and this is what the phpinfo is showing?
In that case why are PHP Warnings still being logged? Unless order of the error_reporting values matters?
0 -
I don't have a good explanation for that - could you submit a ticket so this can be examined directly on your system?
0 -
cPRex
Will do.0
Please sign in to leave a comment.
Comments
13 comments