Update (January 21, 2014): Magento has now released patches to make Magento 220.127.116.11-18.104.22.168 compatible with PHP 5.4.
Back in July the developers of PHP started encouraging moving from PHP 5.3 to either PHP 5.4 or 5.5 due to the fact that for the next year the only support for PHP 5.3 would be security updates and thereafter support will end entirely. We have now started to see that shift happening and along with it we are seeing an increase in questions and issues related to Magento’s support for PHP 5.4 and 5.5.
As with previous moves from one PHP version to another, PHP 5.4 and 5.5 have made breaking changes from earlier versions of PHP. That means that software can stop working on a new version of PHP and you should make sure that software you are using is compatible with the new version of PHP ahead of the upgrade. Currently Magento does not officially support PHP 5.4 or 5.5. Magento’s System Requirements page currently lists supported versions of PHP being 5.2.13 – 5.3.24. While PHP 5.4 and 5.5 are not officially supported we have found Magento will run on them, but there a couple of important issues that can cause problems that we will get to in a moment.
While we recommend upgrading to Magento 22.214.171.124 as it includes a number of security enhancements and other enhancements, upgrading to that version will not provide improved compatibility for the newer version of PHP even if you are currently using a fairly old version of Magento. We recently did an upgrade of website that was still running Magento 1.3 and that website that was running without issue on PHP 5.4.
There are two areas where you can run into problems when using PHP 5.4 or 5.5:
Order Invoice Printing Error
The one issue that we have found does occur in Magento when using PHP 5.4 or 5.5 is that when you try to print an order’s invoice you will get an error: “Fatal error: Declaration of Zend_Pdf_FileParserDataSource_File::__construct() must be compatible with Zend_Pdf_FileParserDataSource::__construct()”. There is an easy fix for this. In the file /lib/Zend/Pdf/FileParserDataSource.php change the line:
abstract public function __construct();
abstract public function __construct($filePath);
While Magento will work with the newer versions of PHP, extensions may not be compatible with newer versions of PHP. PHP 5.4 was released in March of 2012 and 5.5 was released in June of this year, so the latest release of extensions should be compatible with the newer version of PHP by now. The developer of the extension should also be able to tell you if it is compatible with the newer version of PHP. If you want to insure everything will run smoothly, test a copy of the website running on a server using the newer version of PHP before the server with the live website has its PHP version updated. If an extension is not working with the new version of PHP and you don’t want to replace the extension you can use the details of breaking changes in PHP 5.4 and 5.5 as a starting place to determine what changes need to be made to the extension.