I'm unable to install PHP5 in Ubuntu 16.04 [duplicate]

root@areeb-Inspiron-3420:/var/www/html# apt install php5
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
root@areeb-Inspiron-3420:/var/www/html# apt-get install libapache2-mod-php5
Reading package lists... Done
Building dependency tree... 50%
Building dependency tree       
Reading state information... Done
Package libapache2-mod-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 'libapache2-mod-php5' has no installation candidate

What should I do now?


Ubuntu 16.04 LTS comes with PHP 7.0. To install it, you need to run:

sudo apt-get install php

Or rather pick a specific PHP Web SAPI, most probably you need support for Apache2:

sudo apt-get install libapache2-mod-php php

Or PHP FPM

sudo apt-get install php-fpm php

If you specifically need PHP 5.x, you'll need to use ppa:ondrej/php and install, f.e. PHP 5.6 for Apache2:

sudo apt-get install php5.6 libapache2-mod-php5.6

16.04 does not have PHP 5 in the official repositories. Install a 14.04 system, or use this PPA.