How to install PHP7.1 and PHP 5.6 in Ubuntu 14

How to install PHP7.1 and PHP 5.6 in Ubuntu 14 Update the repositories sudo apt-get update Add PPA for PHP7 to the system apt repository sudo add-apt-repository ppa:ondrej/php then...

How to install PHP7.1 and PHP 5.6 in Ubuntu 14

Update the repositories

sudo apt-get update

Add PPA for PHP7 to the system apt repository

sudo add-apt-repository ppa:ondrej/php

then again do update the repository

sudo apt-get update

Install PHP7.1

sudo apt-get install php7.1

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

sudo a2enmod php7.1

sudo service apache2 restart

To install PHP 5.6

sudo apt-get install php5.6 libapache2-mod-php5.6

Now tricky part is to enable/disable mod for PHP7.1 and PHP5.6 to switch between both version.

When we have both PHP5.6 and PHP7.1 installed.

To run PHP7.1

sudo a2dismod php5.6

sudo a2enmod php7.1

sudo service apache2 restart

To run PHP5.6

sudo a2dismod php7.1

sudo a2enmod php5.6

sudo service apache2 restart

In Ubuntu 14.4 when you install PhpMyadmin then it install Php5.5.9 along with it and it enable the mod by default.

and you will get error while switching between those version. here you have to permanently disable the PHP5.5.9

sudo a2dismod php5

Now you have both the version installed and can easily switch between PHP5.6 and PHP7.1.

 

You may also like :

solve phpinfo() shows version 5.5.9 but in cli php -v shows version 7.1

Basic easy steps to install Apache, PHP, MySql and PhpMyAdmin in Ubuntu

How to install nginx, mysql, phpmyadmin, php in Ubuntu

Categories
Linux

I am a proud Indian, proud father, a blogger, Being in a profession as System administrator, my passion is troubleshooting computer issues, I do like sharing solutions through blogging making videos of solving issues.
No Comment

Leave a Reply

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

RELATED BY