Magento speed with PHP 7

Magento performance is a recurrent problem for all developers and store owners. But PHP 7 has been released and you should think about using it, benchmark is amazing!


PHP community was waiting for it since months and PHP 7 is now released! It means that you are already able to test it against all your PHP applications. I won’t talk about all the awesome features coming but rather focus on its usage with Magento.

Magento is based on its own framework that is also based on the Zend Framework which make any request using hundreds of PHP files and lines of code. It has always been a problem and you have probably tried all the possible improvements such as FPC, Magento Compilation, PHP and OPcache tweaking, Varnish or anything else that would have relieved your Magento installation. It is still useful to use these solutions but you can now also consider using PHP 7 really soon. I have made some basic benchmarking with PHP 5.5, PHP 5.6 and PHP 7 on a fresh Magento installation with sample data installed. Results are amazing!

Benchmarking Magento 1.9 and PHP 7 (with sample data)

I have made these tests on my own MacBook Pro from the terminal. Hardware don’t really matter here since tests are all ran on a same basis. I have called all the URLs of the Magento Demo Store 5 times with cURL requests and for each PHP version.

Here is the result:

PHP 5.5

Show Details

PHP 5.6

Show Details

PHP 7.0

Show Details

Make your own tests

A minor incompatibility has to be fixed before using Magento with PHP 7.

You have to modify the file app/code/core/Mage/Core/Model/Layout.php on line 555:

Modify the line so it looks like this:



PHP 7 can now be used on production environments. This version is going to revolutionize PHP usage and applications. Can’t wait testing it with Magento 2 ;)

10 Responses to “Magento speed with PHP 7”

  1. Miguel says:

    How did you installed Magento with PHP7? Is there any VM you used?

  2. Werfu says:

    You should try to benchmark the latest HHVM version too. Quite a lot of effort have been put into HHVM to be able to run Magento without a hitch and I can say that most of the time it work flawlessly!

  3. Francis Kim says:

    Interested to know if it ran out of the box! But thank you for this post.

  4. Craig Carnell says:

    Unfortunately you cannot login to the /admin system with PHP 7.0 RC1. Any ideas how to fix this?

  5. Bryan Veloso says:

    Awesome performance! Can’t wait to try it in my remote server. :D

  6. Azaz says:

    I also saw some benchmarks of PHP 7 and PHP 5.6 on cloud servers. The numbers were really impressive. Here is that post I was talking about:

  7. Lars says:

    The server was updated to PHP 7, and then I couldn’t get access to my website. I changed the line:
    $out .= $this->getBlock($callback[0])->$callback[1]();
    $out .= $this->getBlock($callback[0])->{$callback[1]}();
    in the file “app/code/core/Mage/Core/Model/Layout.php”

    Now the website is working – NICE….
    Now I can’t login to the backend.
    Every time I try it doesn’t give me an error, just this:”And then alot of numbers”/

    If I type in the wrong password it will return with following:
    “Invalid User Name or Password.”

    So it seems like it knows I type the correct user and password, but for some reason will not let me in.

    Can someone tell me how to fix this problem, so I can get into the backend of my website? Please! thanks.

Leave a Reply to Azaz

* Required fields