Downgrade the PHP version in ubuntu
How to downgrade PHP version in ubuntu?
How to change PHP version in Ubuntu?
This tutorial will help you to downgrade the PHP version in Ubuntu.
To start the downgrade process, First, we need to check the PHP version installed.
How to check the present PHP version
php -v
How to check all the installed PHP version
php -a
Now, We will be removing all the PHP versions from the server
Note:- Before removing you should check all the installed modules so that after changing the version you do not face any issues.
How to remove all the installed PHP version in ubuntu
sudo aptitude purge `dpkg -l | grep php| awk ‘{print $2}’ |tr “\n” ” “`
After removal, we will be installing the required PHP version. But before installation, we need to install the below repository.
Install the repository
Through this repository, you will be able to install any version 5.5 5.6 7.0 7.1 7.2
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
I am going to install the 5.5 PHP version.
Install the PHP 5.5 version
sudo apt-get install -y php5
There are few dependencies that are very major required with PHP installation. We have listed below.
Dependencies for PHP 5.5
- php5-fpm
- php5-mcrypt
- php5-curl
- php5-cli
- php5-mysql
- php5-gd
- php5-intl
- php5-xsl
Installing the dependencies
sudo apt-get php5-fpm php5-mcrypt php5-curl php5-cli php5-mysql php5-gd php5-intl php5-xsl
One more installation I have tried using the same method. PHP 5.6
Install the php 5.6 version ( do the same steps for other versions as well )
sudo apt-get install php5.6
List of Dependencies PHP 5.6
- php5.6-fpm
- 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-zip