There are times when your site will give PHP errors after an upgrade or a site move that were not there before. One of the more common errors we see with Content Management Systems is the strict standards error. It normally appears at the top of the page and looks something like the following one from a Joomla site.
Strict Standards: Non-static method JLoader::import() should not be called statically in
on line 34
This error in particular can seem confusing since it was not in your previous setup. Never fear, this is nothing terrible and easy to take care of.
What is the strict standards error?
This is not an actual ‘error’ message but merely an informational message meant more for developers. It does not mean that code needs to be altered in your script.
Why you are getting the strict standards message
The E_STRICT setting was not included in the E_ALL group setting until PHP version 5.4, so it had to explicitly be set to report the messages. In most cases, this was not part of a default setting, so it did not show up. As of 5.4, however, E_ALL included E_STRICT so it now displays unless specifically excluded. If you are coming from a server that has a PHP version lower than 5.4, this may be why the error is displaying on your site with our servers and did not display on the old server.
How to remove the ‘Strict Standards’ message
- Log into your cPanel dashboard.
Find the Files section and click on the File Manager icon.
Inside the php.ini file, locate the section for error reporting and then locate your particular setting. It will be the one without the semicolon ‘;’ in front of it.
- Add & ~E_STRICT to the end of the active error reporting line. For example, if your current setting is:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
You would change it to read:error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
- Click on the Save Changes button in the upper right corner of the screen.