The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

strict standards in php 5.4

Discussion in 'General Discussion' started by madpato, Feb 9, 2013.

  1. madpato

    madpato Active Member

    Joined:
    May 30, 2008
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    6
    Hello

    I have recently updated my server to php 5.4.11 and now some of my customer's websites show a lot of strict standards messages, i have tried to put in the error_reporting section this:

    Both are not working and i get a lot of errors on some websites, i know first advice is to fix the code, but i dont maintain those websites so its not my job to do it so im looking for a solution server-side.

    Reading here: PHP: error_reporting - Manual I noticed that E_STRICT is now part of E_ALL so this complicates even more things.


    Any ideas? thank you.
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,474
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Is this enabled via Easy Apache?

     
  3. madpato

    madpato Active Member

    Joined:
    May 30, 2008
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    6
    I have to look for that option... thanks.
     
  4. PvUtrix

    PvUtrix Well-Known Member

    Joined:
    Mar 12, 2005
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Ekaterinburg - Russia
    cPanel Access Level:
    Root Administrator
    Yes, and I can't disable strict error messages, please help! What value should error_reporting have?
     
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,474
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  6. skizo

    skizo Member

    Joined:
    Dec 24, 2012
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Hello. I have migrated my website (running in php 5.3) to a new VPS Server with cpanel and php version 5.4, and now, my website display many errors "Strict Standards" What's happening?
     
  7. activa

    activa Well-Known Member

    Joined:
    May 23, 2006
    Messages:
    204
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Morocco
    cPanel Access Level:
    Root Administrator
    the same error here, after upgrade to php 5.4.X the E-STRICT error message appear in all old project or old Joomla/WordPress .

    the E_STRICT is now part of E_ALL , so we can't contrôle the error output .

    any suggestion to disable this error message from displaying in pages ?
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You can try modifying the error_reporting entry in /usr/local/lib/php.ini to:

    Code:
    error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
    Ensure you restart Apache and clear your browser cache after making the change.

    Thank you.
     
  9. AppWeb

    AppWeb Registered

    Joined:
    Sep 5, 2013
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi, we just upgraded to WHM 11.40.1 (build 11) and PhP5.4.25 and tried error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT we're still seeing STRICT errors and all of our older website is not working. I am setting this via WHM PhP Configuration editor by the way.

    Any other setting to try please?
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  11. corporatehost

    corporatehost Member

    Joined:
    Jul 17, 2014
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi Guys,

    Check this out how to disable E_STRICT Errors in php 5.4

    ------------------Source from php.net --------------

    PHP: Runtime Configuration - Manual

    => Note:

    In PHP 5 a new error level E_STRICT is available. Prior to PHP 5.4.0 E_STRICT was not included within E_ALL, so you would have to explicitly enable this kind of error level in PHP < 5.4.0. Enabling E_STRICT during development has some benefits. STRICT messages provide suggestions that can help ensure the best interoperability and forward compatibility of your code. These messages may include things such as calling non-static methods statically, defining properties in a compatible class definition while defined in a used trait, and prior to PHP 5.3 some deprecated features would issue E_STRICT errors such as assigning objects by reference upon instantiation.

    ---------------------------------------------------

    Simple Fix is to add the below error_reporting value just as integer 30711 in the global php.ini file and restart apache server.

    error_reporting 30711

    You might think why 30711 ? Here we go,

    E_ALL equivalent integer value is : 32767 for php 5.4.x

    30711 => [ E_ALL ] - E_NOTICE - E_STRICT => Here, by adding error_reporting 30711 , will show you all the errors except E_STRICT and E_NOTICE Errors.

    30719 => [ E_ALL - E_STRICT ] => Here, by adding error_reporting 30719 , will show you all the errors except E_STRICT errors.

    Likewise you can remove any errors you could.

    Now, here is the calculation that might help you,

    E_ERROR ===> 1
    E_WARNING ===> 2
    E_PARSE ===> 4
    E_NOTICE ===> 8
    E_CORE_ERROR ===> 16
    E_CORE_WARNING ===> 32
    E_COMPILE_ERROR ===> 64
    E_COMPILE_WARNING ===> 128
    E_USER_ERROR ===> 256
    E_USER_WARNING ===> 512
    E_USER_NOTICE ===> 1024
    E_STRICT ===> 2048
    E_RECOVERABLE_ERROR ===> 4096
    E_DEPRECATED ===> 8192
    E_USER_DEPRECATED ===> 16384

    1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 +256 +512 + 1024 + 2048 + 4096 + 8192 + 16384 = 32767 => E_ALL

    AS E_STRICT is now added to E_ALL, If you would require to remove E_STRICT Errors from E_ALL, Addition and Subraction concept.

    32767 - 2048 = 30719

    E_ALL - E_STRICT = E_ALL without E_STRICT errors.

    /usr/local/lib/php.ini => Find error_reporting. Comment the line and add the below line.

    error_reporting 30719

    Now restart your apache server. Check your domain now to see E_STRICT Errors Vanished !!!
     
    #11 corporatehost, Aug 21, 2014
    Last edited: Aug 21, 2014
Loading...

Share This Page