XAMPP – Fixing 'Strict Standards' Errors

This tutorial is for XAMPP 1.7.4 and XAMPP 1.7.7.

It addresses the problem of many errors being generated by popular PHP applications (notably Joomla!) that you would expect to work, but, instead, generate lots of errors.

If you have installed XAMPP 1.7.4 or XAMPP 1.7.7, you may have noticed that some applications (notably Joomla 1.5.x, 1.6.x, and 1.7.x) generate lots of errors along the lines of:

Strict Standards: Accessing static property JCache::$_handler as non static in C:\xampp\htdocs\joomla\libraries\joomla\cache\cache.php on line 420

This happens because these versions of XAMPP ship with default PHP settings that cause the PHP interpreter to choke on poor programming practices and deprecated (obsolete) language features. For developers, this is a good thing, but for the general user, it causes a lot of grief.

(1) Go to the php directory under XAMPP. Normally, this would be C:\XAMPP\php, but you may have installed it to a different drive or directory (mine is installed in C:\xampp-1.7.4). Locate the file named php.ini . Open this file using a plain text editor – like notepad. Using a word processor (like Word) will very likely seriously corrupt the file. (I use an application called Notepad++). Note: The icon associated with php.ini will depend on what application is associated with .ini files.

The file is 86KB in XAMPP 1.7.4 and 1.7.7.

There are two files called php.ini-development and php.ini-production, you might think you could just rename the php.ini file and use the production one, but it doesn’t work either.

(2) Find the line error_reporting = E_ALL | E_STRICT . In the XAMPP 1.7.4 and 1.7.7, this is line 516:

(3) Change the E_ALL | E_STRICT to E_ALL & ~E_NOTICE & ~E_DEPRECATED.

(4) Save the file.

(5) Restart the Apache server. The easiest way is to open the XAMPP control panel and click on the Stop button. Then click on Start to restart it. (You could also reboot the computer, but that is not necessary.)


5 Comments

  • Ron says:

    This worked like a charm for Joomla 2.5 on xampp. What a pain in the ass that was until I read this! Thanks! +++++++++

  • Borna says:

    It doesn’t work for me.
    After this procedure i cannot connect to local host, what is happening?

  • Borna says:

    Finally it’s working but i had to restart my laptop, not only xamp.
    Thanks a lot!!

    • admin says:

      It is likely you had the XAMPP services running and what you had done was shut down the console but not theservices.
      After rebooting, the services would have restarted and picked up the new changes.
      I’m glad it worked for you and thanks for letting me know!