我无法在 Ubuntu 16.04 中安装 PHP5

Are*_*ani 13 php 16.04

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
Run Code Online (Sandbox Code Playgroud)

我现在该怎么办?

oer*_*dnj 22

Ubuntu 16.04 LTS 附带 PHP 7.0。要安装它,您需要运行:

sudo apt-get install php
Run Code Online (Sandbox Code Playgroud)

或者更确切地说,选择一个特定的 PHP Web SAPI,很可能您需要对 Apache2 的支持:

sudo apt-get install libapache2-mod-php php
Run Code Online (Sandbox Code Playgroud)

或 PHP FPM

sudo apt-get install php-fpm php
Run Code Online (Sandbox Code Playgroud)

如果您特别需要 PHP 5.x,则需要使用ppa:ondrej/php和安装 PHP 5.6 for Apache2:

sudo apt-get install php5.6 libapache2-mod-php5.6
Run Code Online (Sandbox Code Playgroud)


fkr*_*iem 1

16.04 官方存储库中没有 PHP 5。安装 14.04 系统,或使用此 PPA