Fixing the Strict Standards Error in php.ini

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

  1. Log into your cPanel dashboard.
  2. click file manager icon

    Find the Files section and click on the File Manager icon.

  3. open the php.ini

    Once in the File Manager, navigate to the php.ini file and open it for editing. If you do not have a php.ini file, please contact Live Support so they can place one in your account for you.

  4. find the error reporting

    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.

  5. 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
  6. Click on the Save Changes button in the upper right corner of the screen.
BeforeAfter
settings prior to change

2 thoughts on “Fixing the Strict Standards Error in php.ini

  1. Can you please put a php.ini file in [my site] so I can modify it to fix the error messages I am getting now that I have updated my PHP? Thanks.

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X