If you try to run Magento 1.9 on php7 you will find some compatibility problems.

Hopefully the most relevant are 2 and are easy to fix.

Run Magento on php7 would give you a lot better website performances as improvement made on php7 make website run realy faster.

On the first attempt to load a Magento page using PHP 7.0 you probably will get the following error:

Fatal error: Uncaught Error: Function name must be a string in app/code/core/Mage/Core/Model/Layout.php:555

It happens because in PHP 7 you need to clarify that you are going to call the `$callback` variable as a method (function). So, the original line of the code looks like the following (file app/code/core/Mage/Core/Model/Layout.php):

$out .= $this->getBlock($callback[0])->$callback[1]();

In order to make it work on the latest PHP version we need to replace this piece of code by this one:

$out .= $this->getBlock($callback[0])->{$callback[1]}();

Please note that you should not edit the mentioned file directly. The most preferred way is to create a separate extension and override “Mage_Core_Model_Layout” by your own model and make the changes there. Or you can create a new directory:


Then copy “Layout.php” file there and make all necessary changes inside of the new copy. Do not forget to clean the cache after all modifications.

After these adjustments you should be able to load your store’s pages successfully.


Next problem your will find is related to images upload. When you’ll try to upload images on products or category you could have error shown on admin or Fatal error on log files.

Hopefully even for this the fix invoile only one file:


Due to uniform variable syntax the code is now interpreted strictly from left to right.

The Line


should be


After this small adjustment the image upload will start again to work without errors.

For now no other incompatibility with php7 have been found, we’ll update this article if other fix will be needed.


Leave a Reply

Your email address will not be published. Required fields are marked

This site uses Akismet to reduce spam. Learn how your comment data is processed.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
Success message!
Warning message!
Error message!