so I've recently installed my first Ubuntu, to be precise, a daily build of 16.04, on my new laptop since the hardware was to new for 15.10. Now I'm in the process of setting it up and I want to install php5 and some extensions.
When I execute sudo apt-get install libapache2-mod-php5
I get the error message that there is no installation package available for php5 and libapache2.
The error message is in german, so I doubt that this would help, but anyways here it is. 🙂
E: For package »libapache2-mod-php5« existiert kein Installationskandidat.
Do I need to add a apt-get repository? Or what am I doing wrong?
Best Answer
TL;DR: If you want to stay with php5, you will need to stay at Ubuntu 14.04 LTS
Using PHP 7.0 on Ubuntu 16.04 LTS
Ubuntu 16.04 has switched to PHP 7.0 with a new infrastructure for PHP package. So, no, you can't install php5 on Ubuntu 16.04, but you can install PHP 7.0 packages with:
apt-get install libapache2-mod-php
That will install a virtual package that depends on the latest PHP version and pull
libapache2-mod-php7.0
as a dependency.If you are looking for extensions, always use a version-less variant as well (e.g.
php-apcu
instead ofphp7.0-apcu
) as the PECL extensions are packaged without the version to allow smooth upgrades.Using PHP PPA to coinstall PHP 5.6 with PHP 7.0
There's an option to co-install PHP 5.6 packages using
ppa:ondrej/php
.For more information, please see that answer: https://askubuntu.com/a/762161/309221
Extracted from link above: