How to Upgrade PHP 5.6 to 7.1 on Ubuntu

You have two completely separate versions of PHP installed on your system. The config files for PHP 5.6 is /etc/php/5.6 and for PHP 7.1 is /etc/php/7.0 respectively. Some of the reasons you need to use PHP 7.1 without removing PHP 5.6.

Upgrade PHP 5.6 to 7.1

See Also:

  • Install PHP7 on Ubuntu Server 15.10, 15.04 & 14.04 using PPA
  • Install PHP 7 on CentOS/RHEL 5/6/7
  • Install LAMP (Apache 2.4, MySQL 5.6, and PHP 7.0) on Ubuntu using PPA
  • Install LAMP (Apache 2.4, MySQL 5.6, and PHP 7.0) on CentOS/RHEL 7
  • How to Upgrade PHP version 5.4 to 5.6 on CentOS/RHEL 6/7
  • How to Upgrade PHP version 5.4 to 5.5 on CentOS/RHEL 5/6/7
  • So we are mentioning the steps to upgrade the PHP.

    Upgrade PHP from 5.6 to 7.1

    Suppose PHP 5.6 is set on your system and you need to upgrade it to PHP 7.1 without removing PHP 5.6. Run below command to upgrade the PHP version.

    Apache:

    $ sudo a2dismod php5.6
    $ sudo a2enmod php7.1
    $ sudo service apache2 restart
    

    Command Line:

    $ update-alternatives --set php /usr/bin/php7.1
    

    Enjoy it!

    Leave a Reply

    Your email address will not be published.

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.