<=> PHP7 and Magento (M)


I finally installed PHP7 this weekend and ran some Magento local dev sites. The speed increase is impressive! It’s so much faster that it should be a mandatory requirement.

There’s only a couple of minor quirks, like not having dl() support which killed a couple of the extensions that had copy-protection on one site.  There’s a couple of small things to do to make PHP7 work but it’s covered below.  If you’re ready to take the Magento/PHP7 plunge and are using Ubuntu then this is how you can do it.

First, you have to remove your php5 install.

Remove php5

Warning: This will remove php5 from your system completely. 

sudo apt-get purge php5-*

Add the PHP7 repository

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update

Install PHP7

sudo apt-get install php7.0

Install PHP7 components

sudo apt-get install php7.0-cli php7.0-common libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-fpm php7.0-curl php7.0-json php7.0-cgi php7.0-mcrypt

sudo service php7.0-fpm restart

sudo service apache2 restart

The Magento PHP7 Fix

Inchoo has this ready in an easy to install extension: https://github.com/Inchoo/Inchoo_PHP7

You may also need:

sudo apt-get install php7.0-intl php7.0-xsl php7.0-gd

(Thanks to Dave Moore for the tip)


Common problems with Magento after installing PHP7

If Apache is dumping plain text php instead of rendering it then be sure that you’ve installed libapache2-mod-php7.0.

sudo apt-get install libapache2-mod-php7.0

sudo service php7.0-fpm restart

sudo service apache2 restart

Getting a white page or error about mcrypt in Magento?

sudo apt-get install php7.0-mcrypt

sudo service php7.0-fpm restart

sudo service apache2 restart