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
我现在应该怎么做?
答案1
Ubuntu 16.04 LTS 附带 PHP 7.0。要安装它,您需要运行:
sudo apt-get install php
或者选择一个特定的 PHP Web SAPI,很可能您需要对 Apache2 的支持:
sudo apt-get install libapache2-mod-php php
或者 PHP FPM
sudo apt-get install php-fpm php
如果您特别需要 PHP 5.x,则需要使用ppa:ondrej/php
并安装适用于 Apache2 的 PHP 5.6:
sudo apt-get install php5.6 libapache2-mod-php5.6
答案2
16.04 在官方存储库中没有 PHP 5。安装 14.04 系统,或使用此 PPA。