PHP 7 and Magento - Let's look how they coexist!

Magento and PHP 7

Some experts say that it runs over 50 %, others state that 80 %. But, the precise data has still not been found. It is well-known that such giants as WordPress and Drupal are written in PHP. And Magento open source ecommerce platform, which is popular all over the world (in the USA, the UK, Germany, Australia),  is not the exception. 

PHP and Magento relations developing

For the first time, the ecommerce community witnessed Magento release on 31st March, 2008. It was called “Bento”. At that time the current PHP version was 5.2.  Recent years, all of us use Magento 1.9, which supports PHP versions up to 5.5.x. However, Magento platform has already started running on PHP v5.6. This year, our global ecosystem of Magento partners and developers has seen a release of the next generation open source ecommerce Magento 2.0 platform. It presents such improvements, as:

  • Open Architecture; 
  • Engaging Shopping Experience; 
  • Enhanced Business Productivity;
  • Easier Maintenance;
  • Improved Scalability and Performance;

On the one hand, it is considered as a progress of website  building. On the other hand, it means that in some time,  the first Magento platform version will lose official support. And these are bad news for those who are going to continue working with Magento 1.x for the next couple of years. Our Sam Ecommerce company makes the list of such Magento partners. Our developers have still been trying to find possible ways to enhance Magento 1.x. They want to keep it compatible with the latest solutions from the world-wide web-technologies. 

So, now, after PHP v7 coming, it is the rightest time to make all our efforts and start our findings. However, it should be mentioned that Magento 1.9 is not compatible with the latest “out of the box” version, but luckily, it’s easy enough to settle.

PHP 6 version - exist or not

As you know, the previous PHP version was 5.6.x. And now, the latest is 7.0. It seems to me many people wonder where is 6.0 version. And we have an answer. PHP 6.0 existed, however, only as a test project. It was not created for production. To avoid the mix-up of these two version, the latest edition has been called PHP 7. There is one more reason of such omission. Seven is a lucky number and PHP creators believe that it can bring them success.

Reasons to shift to the PHP 7

Generally, there are a lot of  reasons to shift to the PHP 7. Having analyzed a number of existing expert options, we have come to conclusion that the main reason is a higher speed.  PHP 7 is significantly 2X faster than previous version. And now we want to advise you about developers’ attitude to the PHP 7 and its importance for Magento platform. That is what we have found. 

It is well-known that Magento 1.x is not officially compatible with PHP 7. However, it is quite simple to patch it.  But here another question arise - is it worth to do it? 

PHP 7 permanently provides double PHP 5.6 performance, together with such things as: MySQL, OpCache setup, hardware, and other. It is interesting that PHP 7 enhances performance everywhere.  It improves even the worst case scenarios, when other technologies, for example Varnish or Redis caches enhance just the best case scenario. It works on a new higher level. It can really make your online store built on Magento 1 work faster.

However, the performance is not the only improvement here. There are also other  new and very important features. We would like to highlight three of them - improved input type hints, return type declarations, and the null coalesce operator. They really play an essential part in preventing a class of bugs and security gaps, and also they make code more self-documenting.

All these PHP 7 features are not used in Magento 2 and even in 3rd party extensions. It is explained by the need to keep compatibility with PHP 5.5 as well as 5.6 versions. When our development team gets to know that the project is on a PHP 7 server, we introduce all these favors in our custom code. 

Finally, we want to present you the comparison results of two clean Magento installations with official sample data populated on PHP 5.6 (OpCache enabled) and PHP 7.0 (OpCache enabled). They are based on 20 simultaneous visits for some category pages: one configurable product info page, search results page and about us page. Let’s look at the diagram:

PHP 5.6

Magento PHP 5 results

PHP 7.0

Magento PHP Results

In conclusion, we would like to say that PHP 7 presents a lot of really measurable advantages, which are long-expected by Magento developers. The list includes: the substantial performance enhancement, ability to correct serious errors as well as to accurate type declarations and null coalescing operators.  And we can see that PHP 7 is really faster. That is why we think that it is worth to be tried in case of Magento. Read more our articles about Magento news:

If you have any questions regarding the latest PHP version or Magento, our Sam Ecommerce team will be happy to help you!

Comments (1):
Posted on Wednesday, September 14, 2016 by :
I saw on a blog post that Magento 2 with PHP 7 has response time of 86ms with 100% hit rate. That's quite an impressive figure. It's unbelievable that Magento 2 and PHP 7 has improved this much. Here is the blog post I was talking about: This blog post has detailed benchmarks of Magento 2 with PHP 7
Leave a comment:
*Your comment will be published after approval by site administrator.