Muhammad Shahzad Muhammad Shahzad - 1 year ago 138
PHP Question

Package 'php5' has no installation candidate on ubuntu 16.04 LTS

I have upgraded my system to ubuntu 16.04 LTS, now I have issue this newer version install php 7 and remove the php 5, How I can install php 5.4 on ubuntu 16.04?

Here I tried something like this:

sudo apt-get install php5

I got this error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5' has no installation candidate

Answer Source

Ubuntu 16.04 comes with PHP7 ,there are no PHP5 packages. Remove all php7 packages:

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "


sudo add-apt-repository ppa:ondrej/php

Update packages:

sudo apt-get update

Install PHP:

sudo apt-get install php5.6

Check PHP Version:

php -v
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download