Chat with us, powered by LiveChat

This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

Our Magento Customers Get 1-Click Hosting and 0.37ms Load Time. Get FREE $20 Credit with Promo Code 'BOOSTMAG.' Join Now!

How to Configure Magento With PHP 7 on Cloud

Updated on March 15, 2016

4 Min Read
magento php 7
Reading Time: 4 minutes

Magento is a powerful and popular PHP based Ecommerce solution. Magento was first released in March 2008 and its first version’s name was “Varien”. At that time, the latest version of PHP was 5.2. Nowadays we are happy users of Magento 1.9.x that supports PHP versions up to 5.5.x but Magento solution runs more smoothly on PHP version 5.6.

There are many merchants who want to smoothen and improve their Magento store. As Magento developers, we need to search new ways for improvements of Magento stores as well as possibilities to make every version of Magento compatible with new solutions. Along with Magento upgrades, PHP versions also get updated periodically. Currently, PHP 7 version is the latest iteration. There are many reasons to switch to the latest version of PHP but the most inspiring of them is that PHP 7 is 2X faster.

Recently PHP 7 hosting has been added to the Cloudways console and in this article, I show you how to configure PHP 7 with your Magento store and I share some performance benchmarks of Magento on PHP 7.

Configure Magento With PHP 7 Using Cloudways

There are no difficulties to configure PHP 7 with your Magento 1.9.x store on Cloudways.  If you launched your Cloudways server prior to 10th of February, you will need to re-launch your server or make a clone to run your Magento app on your server. For more details read this KB.
Follow these steps to configure PHP 7 with Magento.

  • Login to Cloudways with your Username and Password

Login Cloudways

  • After login, click on your server.

Click on server

  • After that, Go to Settings & Packages” and click on “Packages”.  Select PHP “7.0” and click on “Save” button. It will take few moments to get updated.

update PHP 7 server console cloudways

Now you need to make some little changes in your Magento “Layout.php” file. Go to “Master Credentials” and click on “Launch SSH terminal” and Use your Username & Password.

launch ssh terminal

In the “SSH terminal” Go to app/code/core/Mage/Core/Model/ using this command:

cd applications/your-application-name/public_html/app/code/core/Mage/Core/Model/

Now edit the “Layout.php” with this command:

vi Layout.php

After using vi command you will see that your file is being viewed in your terminal screen. To edit your file press “Insert Key” on your keyboard and under ” public function getOutput()”  you need to replace “$out .= $this->getBlock($callback[0])->$callback[1]();” to “$out .= $this->getBlock($callback[0])->{$callback[1]}();

Now save your “Layout.php” file in editing mode by pressing Esc key on your keyboard and press :w to save it and to exit editing mode press :q. Clear your Magento cache and here you are done with configuring Magento 1.9.x with PHP 7.

Magento 1.9.x Precautions for PHP 7

Before upgrading to PHP 7 for your Magento 1.9.x store, do keep these pointers in mind. We do not recommend upgrading  your live site to PHP 7 before testing the following

  • Make sure that extension you used is compatible with PHP 7
  • Make sure your Magento custom code and API version is compatible with PHP 7
  • Make sure that the theme you are using in your Magento store is compatible with PHP 7
  • Always keep a recent backup of your Magento store

You can clone your live site to a staging URL on a new server and perform all the actions. Once you are confident that it’s ready, then you can point your domain to the new staging site.

Note: Do not upgrade to PHP 7 on your running Magento store. Our suggestion is to make a clone of your Magento app or your Cloudways server in Cloudways console before upgrading to PHP 7.

Benchmarks of PHP 7 With Magento

Here are the benchmarks of Magento 1.9.x with PHP 7 and Magento 1.9.x with PHP 5.6 which you can see in the images below. I don’t even have to explain them. Just look at the huge difference in performance between PHP 5.6 and PHP 7.  

Magento with PHP 5.6

Magento with PHP 5.6

Magento with PHP 7

Magento with PHP 7

Time to Play in the Staging Area

With the release of PHP 7 everybody is testing their Magento 1.9.x store on this latest version. On the Cloudways Platform you can upgrade your PHP version with one click and improve your Magento store performance. Launch your free trial on the Cloudways with PHP 7 on Magento Hosting and start testing!

I would appreciate your suggestions and views on PHP 7. Let me know in the comments below how your Magento store is performing on this new version.

Share your opinion in the comment section. COMMENT NOW

Syed Muneeb Ul Hasan

Syed Muneeb Ul Hasan is a Magento Developer and Blogger at Magenticians - a platform for Magento Tutorials. He is an expert in PHP and Magento and prefers to educate users in the implementation of Magento. When not working, he loves to play games and watch cricket.

Boost Conversions by 70%. Move to Magento Managed Cloud Server


Free SSL, Free Migration, Optimized Stack, Built-in Varnished Cache and much more.


Get Our Newsletter
Be the first to get the latest updates and tutorials.