Magento 2.1.18 is the final 2.1.x release. After June 2019, Magento 2.1.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

PHP 5.6 or 7.0—Ubuntu

If you must install both Apache and PHP, install Apache first.

PHP versions supported

Supported PHP versions:

  • ~5.6.5

  • 7.0.2

  • 7.0.4

  • ~7.0.6

  • ~7.1.0

For versions 2.1.16 and later, Magento supports PHP 7.1 for the 2.1.x release line. The other supported PHP versions remain valid and unchanged.

Help if you’re just starting out

If you’re new to all this and need some help getting started, we suggest the following:

Verify PHP is installed

To verify if PHP is installed already, enter php -v. If PHP is installed, messages similar to the following display:

1
2
3
4
PHP 5.6.4-1+deb.sury.org~precise+1 (cli) (built: Dec 21 2014 19:26:25)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

The preceding message confirms that the Zend OPcache is installed. We strongly recommend using the OPcache for performance reasons. If your PHP distribution does not come with the OPcache, see the PHP OPcache documentation.

If PHP is installed, continue with the next prerequisite, MySQL.

If PHP is not installed, see one of the following sections:

PHP 7.0 on Ubuntu 14 or 16

To install PHP 7 on Ubuntu 14:
  1. Enter the following commands in the order shown:

    1
    2
    3
    4
    
    sudo apt-get -y update
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get -y update
    sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv php7.0-soap
    

    The bcmath extension is required for Magento Commerce only.

  2. Enter the following command to verify PHP 7 installed properly:

    1
    
    php -v
    

    Following is a sample response that indicates PHP 7.0.8 is installed:

    1
    2
    3
    4
    
    PHP 7.0.8-2+deb.sury.org~trusty+1 (cli) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
      with Zend OPcache v7.0.8-2+deb.sury.org~trusty+1, Copyright (c) 1999-2016, by Zend Technologies
    
    The preceding message confirms that the Zend OPcache is installed. We strongly recommend using the OPcache for performance reasons. If your PHP distribution does not come with the OPcache, see the PHP OPcache documentation.
  3. Continue with Required PHP settings.

PHP 5.6 on Ubuntu 14

To install PHP 5.6 or to upgrade from PHP 5.5 on Ubuntu 14:
  1. Enter the following commands in the order shown:

    1
    2
    3
    4
    
    apt-get -y update
    add-apt-repository ppa:ondrej/php
    apt-get -y update
    apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-soap
    
  2. Enter the following command to verify PHP 5.6 installed properly:

    1
    
    php -v
    

    Following is a sample response that indicates PHP 5.6 is installed:

    1
    2
    3
    4
    
    PHP 5.6.22-4+deb.sury.org~trusty+1 (cli)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    
    The preceding message confirms that the Zend OPcache is installed. We strongly recommend using the OPcache for performance reasons. If your PHP distribution does not come with the OPcache, see the PHP OPcache documentation.
  3. Continue with Required PHP settings.

Next

Required PHP settings

Updated