How to Fix Strict Standards: Non-static method in Joomla?

Some of the users of our templates and modules have experienced an error in Joomla 3 installations that occurs when PHP on their server is set to strict error reporting (E_STRICT) where they receive error messages stating that “Strict Standards: Non-static method … on line XX”, or similar.

Why do I see this message?

If you’re seeing this message often, then it’s very likely that in your server’s php.ini file the current settings include the line “error_reporting = E_ALL | E_STRICT”; what this means is that the system is reporting errors as plain notices. This is an issue, since often what’s considered an ‘error’ by PHP may in fact just be a warning, or reminder to the average user. For example, if you use a modern email client you might get a message if you write the word “attach” or “attached” in an email without actually attaching something to it; it’s a helpful little message to remind you that perhaps you’ve missed something. Strict Error Reporting would turn that simple reminder into a full-blown error, making it seem like something has gone wrong when it hasn’t, really. In fact, the E_STRICT flag is usually put to use by developers to help troubleshoot their products; they need to be aware of every small detail when creating something efficient and stable, but it’s overkill for regular users who are more interested in things working smoothly, and actually considered bad practice for “live sites”.

To Summarize: Essentially, Strict Standards warnings are not errors; they’re messages designed for developers to help troubleshoot their software and such messages don’t need to (and it’s recommended that they shouldn’t) be enabled on a production site.

How to remove the Strict Standards message?

Now, when we say “remove”, what we’re actually saying is “hide”; the cause of the message will still exist, but it’s almost always irrelevant since it’s just the equivalent of a reminder message rather than a true error that needs fixing. There are a few methods for taking care of this:

Method #1: Using Joomla’s settings

Joomla itself has some built-in functionality for controlling server settings:

  1. Login to your Joomla site’s admin panel as an administrator account, then click on System -> Global Configuration in the main menu.
  2. On the configuration screen, click on the “Server” tab and look in the Server Settings option group for the Error Reporting parameter.
  3. Change Error Reporting to “None”, and save changes.
How to disable showing errors in Joomla 3.x

With the changes saved head on back to the frontend of your site and see if you’re still getting the messages; hopefully they should have all disappeared. If not, it means you’ll have to go a bit deeper and directly modify the server’s php.ini file manually. This isn’t a particularly difficult task, but it’s still advisable that someone with web development experience handles this change as any mistake made when editing the file could have rather severe consequences for your site, since PHP is at the core of Joomla and its extensions and templates. So play it safe and get help if you’re not comfortable making this change yourself!

Method #2: Changing php error reporting on the server side (php.ini)

If you’ve tried disabling Strict Standards via Joomla without success, or you’re looking to cut the issue off directly at the source, then you can also disable Strict Standards on your server via the php settings, which are stored in the php.ini file. This file is usually found in the root folder of your server, so you’ll need to connect to your site via FTP. Once there, find and open your php.ini file with the editor of your choice. There’s usually quite a few options listed here, but the specific one you’re looking for is the error_reporting attribute. Once you’ve found this line you’ll have to replace this attribute with the following code:

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED

…and then saving the changes and uploading the modified file back to its original location.

Warning: If after making this change you find that you’re getting another error such as a 500 Internal Server Error (aka HTTP 500 error), then you should contact with your host’s support team who will be able to provide you with details on how and where to override the php.ini file, since some hosts are quite protective of this file due to how necessary it is for smooth server operation. Once they advise you of their preferred modification method you can check it and try making the change once again.