Skip to main content

Stopping PHP warnings in error log files

Comments

13 comments

  • mtindor

    Where specifically did you make that change?   In the Select PHP Version option inside cpanel?   Inside a php.ini file?   Elsewhere?

    0
  • SPDTeam

    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
  • mtindor

    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
  • SPDTeam

    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
  • cPRex Jurassic Moderator

    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
  • SPDTeam

    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
  • cPRex Jurassic Moderator

    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
  • SPDTeam

    cPRex

    The phpinfo settings shows error_reporting as 22517 (local and master).

         
         
         
         
         
    0
  • quietFinn

    That is E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
    See here:
    https://maximivanov.github.io/php-error-reporting-calculator/

    0
  • mtindor

    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
  • SPDTeam

    quietFinn, cPRex

    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
  • cPRex Jurassic Moderator

    I don't have a good explanation for that - could you submit a ticket so this can be examined directly on your system?

    0
  • SPDTeam

    cPRex

    Will do.

    0

Please sign in to leave a comment.