How to install PHP 5.6 in Ubuntu

The PHP version 5.6 is little bit older one. But still some older applications might required this particular version of PHP.

This article explains the steps to install PHP 5.6 in Ubuntu.

Step1: Install system dependencies.

#apt-get install -y software-properties-common

Step2: Add PHP repository.

#add-apt-repository ppa:ondrej/php

Step3: Update the repositories.

#apt-get update

Step4: Install PHP 5.6.

#apt-get install -y php5.6

Step5: If the system is using PHP 7.0 by default, we need to disable that.

#a2dismod php7.0

Step6: Enable PHP 5.6.

#a2enmod php7.0

Step7: Restart Apache service.

#service apache2 restart

Step8: Update PHP version for Ubuntu terminal.

#update-alternatives --config php

Here we need to select PHP 5.6 and save.

That's all…

Leave a Reply