madpato

Well-Known Member
May 30, 2008
52
1
58
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:

E_ALL & ~E_NOTICE & ~E_STRICT
and:
E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
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.
 

skizo

Member
Dec 24, 2012
9
0
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?
 

activa

Well-Known Member
May 23, 2006
213
1
168
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 ?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
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.
 

AppWeb

Registered
Sep 5, 2013
1
0
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?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,268
463
Are you using the "Silence Deprecated Patch" option in EasyApache under the "Exhaustive Options List" for PHP?

Thank you.
 

corporatehost

Member
Jul 17, 2014
24
0
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?
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 !!!
 
Last edited: