Install PHP 5.4/5.5/5.6 and PHP 7 on Ubuntu

Sean78Black

Member
Joined
May 29, 2016
Messages
84
Points
8
Ubuntu has expanded repository greatly, it fully supports than any other Linux distribution. So you can install any applications with the latest version on the old Ubuntu as Ubuntu 12.04.
The latest version of PHP is supported by the PPA, I feel very stable. Here we will use Ondrej PPA, is now available for PHP 5.4, 5.5, 5.6 and PHP 7. To use apt-add-repository command, you need to install the following packages before:

For Ubuntu 12.04 or earlier, you need to install python-software-properties:

Code:
$ sudo apt-get install python-software-properties
For Ubuntu 12.10 or later, you need to install the software-properties-common package:

Code:
$ sudo apt-get install software-properties-common
Now you need to add one of the PPA that you want below:

PPA for PHP 5.4: only works on Ubuntu 12.04

Code:
$ sudo apt-add-repository ppa:ondrej/php5-oldstable
PPA for PHP 5.5:

Code:
$ sudo apt-add-repository ppa:ondrej/php5
PPA for PHP 5.6:

Code:
$ sudo apt-add-repository ppa:ondrej/php5-5.6
PPA for PHP 7.0: only works on Ubuntu 14.04 or later

Code:
$ sudo apt-add-repository ppa:ondrej/php-7.0
To install PHP-FPM version 5.4 / 5.5 or 5.6, use the following command:

Code:
$ sudo apt-get update
$ sudo apt-get install php5-mysql php5-xmlrpc php5-curl php5-gd php5-cli php5-fpm php-pear php5-dev php5-mcrypt
To install PHP-FPM version 7.0, use the following command:

Code:
$ sudo apt-get install php7.0-fpm
To update PHP to a newer version, use the following command:

Code:
$ sudo apt-get upgrade
So you can choose to install the latest PHP version.

For servers with low memory (1GB), the selection of an OS is very important. Instead of running the latest OS to fill up our RAM, choose the lighter old OS, CentOS is lighter than Ubuntu a bit. Although old, but still install PHP 5.4, 5.5 or run the latest PHP 5.6 as well.

Good luck!
 

extremebizopp

New member
Joined
Mar 22, 2015
Messages
10
Points
0
If you are using a cPanel or Plesk hosting panel then you can ignore this process and you can upgrade or downgrade PHP versions with some clicks only. Especailly in Plesk Onyx, it allowed you to switch between Php 5.x and PHP 7.x easily.
 
Older threads
Replies
0
Views
5,262
Replies
8
Views
4,583
Replies
9
Views
3,364
Latest threads
Replies
0
Views
590
Replies
2
Views
789

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top