We had an interesting case a couple of days ago, one of our clients came to us and told us that while installing Joomla on a new server, he got the following error (multiple times):
Strict Standards: Accessing static property JCache::$_handler as non static in /web/vhosts/ourclientsdomainname.com/libraries/joomla/cache.php on line 420
It was not the first time that we saw this error (we saw it in some generic PHP code), but it was the first time we have seen it when someone was installing Joomla. So, what is this error about and how can someone go about fixing it?
First, it’s not really an error, it’s just a notice because apparently the PHP installation is using strict standards. So, in php.ini the strict standards are enabled. This is actually a good thing and it enforces some good coding practices, however, enabling strict standards can often result in problems in some legacy code.
So how can someone fix this problem?
Well, there are two ways, the hard way and the easy way. The hard way consists of someone actually going through the code and fixing each line of the code that has a problem, which is not recommended.
The easy way is to just change the warning level on the Joomla application to suppress the notices by adding the following lines to your index.php (both in the root of your website and in the administrator folder):
error_reporting(E_ALL & ~E_NOTICE);
The above line will show all errors (including warnings) with the exception of notices (again, a notice is not really an error, but from PHP’s perspective, it is).
Another easy way of doing this is changing the php.ini file, by searching for the error_reporting constant, and changing its value to E_ALL & ~E_NOTICE. So the line will be the following:
error_reporting = E_ALL & ~E_NOTICE;
If you are trying to do the above but it’s not working for you, then, as always, you can contact us, and we’ll definitely help you!