Installing PHP 5.6 on Ubuntu 16.04

Post Reply
  • Author
  • Message
Offline
User avatar
Admin
Posts: 57
Joined: 31 Oct 2013, 13:36
Contact:

Installing PHP 5.6 on Ubuntu 16.04

Post by faridmmv » 22 Sep 2018, 21:42

Our version is: Ubuntu 16.04.5 LTS (Xenial Xerus)

As of Ubuntu 16.04.x default PHP version is PHP7. You should add PHP5 repository and you will be able to install it.

List installed php packages with

Code: Select all

dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
then remove unneeded packages with

Code: Select all

sudo aptitude purge your_packages_here
or if you want to directly remove them all use :

Code: Select all

sudo apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
Add the PPA

Code: Select all

sudo add-apt-repository ppa:ondrej/php
If you get add-apt-repository: command not found run the following command first :

Code: Select all

sudo apt-get install software-properties-common
Install your PHP Version

Code: Select all

sudo apt-get update
sudo apt-get install php5.6
You can install php5.6 modules too for example

Code: Select all

sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml
Verify your version

If you have installed php5.6-cli

Code: Select all

sudo php -v
If you don't have php5.6-cli, put this on a .php file

Code: Select all

<?php 
      //outputs php configuration info
      phpinfo(); 
?>

Source: https://askubuntu.com/questions/756181/ ... nial-16-04
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest