Package 'php5' has no installation candidate

I am trying to install emonCMS and get the following error

Package php5 has no installation candidate

This occurs when following the second step on the instructions on the following link (just after Install all dependencies:)

sudo apt-get install apache2 mysql-server mysql-client php5 libapache2-mod-php5 php5-mysql php5-curl php-pear php5-dev php5-mcrypt php5-json git-core redis-server build-essential ufw ntp

I am installing on a clean VM of Ubunto 16.04 LTS.

Any help would be appreciated.

From Stack Overflow:

Ubuntu 16.04 comes with PHP7 as the standard, so there are no PHP5 packages.
You can add a PPA to get those packages.

Details at the link below.

Instead of adding a PPA, simply remove the 5 from the end of the php on Ubunutu 16.04 as mentioned above, it comes with php7.

sudo apt-get install apache2 mysql-server mysql-client php
libapache2-mod-php php-mysql php-curl php-pear php-dev php-mcrypt 
php-json git-core redis-server build-essential ufw ntp

I was able to load latest version emoncms on ubuntu 16.04 with no issues.

Thanks, note has been added to install guide:

Hi Glyn, another quick correction for the install instructions …
In the section below php5 has been replaced with php7, the correct paths are now


Add pecl modules to php5 config

sudo sh -c 'echo “” > /etc/php5/apache2/conf.d/20-dio.ini’
sudo sh -c 'echo “” > /etc/php5/cli/conf.d/20-dio.ini’
sudo sh -c 'echo “” > /etc/php5/apache2/conf.d/20-redis.ini’
sudo sh -c ‘echo “” > /etc/php5/cli/conf.d/20-redis.ini’

Does Emoncms work with php7?

Please submit a PR so we make sure the correct info gets added to the readme.

Hi Glyn, I can confirm that emoncms does work with php7 as long as apache2.conf is modified and Allow Override is set to All for /var/www/html/emoncms

As far as submitting a PR, sorry but I don’t know what that means.

PR means ‘pull-requst’ on github. I’ve made the changes:

Thanks, I think you are one of the first to run Emoncms on php7. Please confirm if you have any (or none) issues!


Hi yet again Glyn.
I just checked the install notes for php7.
Sorry to advise you that the correct path is
and not

Thanks, I’ve made this fix:

This is why I suggested you create a Git PR. There is less chance of errors. For future ref creating a git PR is very easy for small changes: