How PHP 7 Improves the Performance of Magento

Posted on the 4th May 2016

Magento 2 has been publicly available for a while now, and it’s clear that out of the box it offers some significant performance improvements over Magento 1.9.x. What many people don’t, however, realise is just how much more performance you can get out of the platform if you use the right hosting configuration.


Magento 2 will run on PHP 5.6, but there are numerous benefits to running it on PHP 7 hosting with the Varnish cache. PHP 7 offers a number of performance and scalability improvements, not just for Magento users but for users of other content management systems as well.

Upgrading from Magento 1.9.x to Magento 2.0 requires some careful planning; the migration isn’t always smooth and upgrading your hosting stack to PHP 7 requires some configuration changes too. But both steps are well worth taking because of the speed, security and stability improvements that they offer.

The safest way to migrate is to back up your files and database, then use the migration tool to convert your database to the format required for the new version, and run a fresh install. Before you do this, confirm that your existing extensions will be compatible with the new version (or at the very least, that you can replicate their functionality).

While it’s possible to perform incremental upgrades for point releases, you can’t do this to move to the new version, since the entire back-end has been rewritten, and many of the underlying frameworks have changed.

Stability and Performance

The performance enhancements offered by PHP 7 are some of the main reasons why it is seeing such rapid adoption. It offers performance that is similar to that of Facebook’s HHVM, which uses a Just in Time (JIT) compiler to compile PHP code into machine instructions wherever possible. PHP 7 itself does not rely upon JIT compiling (although that was something that was in discussion), but even without JIT, it offers some significant performance improvements.

For developers, the rollout of PHP 7 is welcome news. Magento store owners themselves won’t need to pay too much attention to the platform upon which their server is running, since the store and extensions will handle that for them.

However, if you are planning to migrate from 1.9.x to 2.0, it is a good idea to take this chance to assess your infrastructure at the same time. Any performance issues that you are currently experiencing could well be fixed if you upgrade your back-end.