![在 ubuntu 14.04 中安装 PHP 7.1 的问题](https://linux22.com/image/1591528/%E5%9C%A8%20ubuntu%2014.04%20%E4%B8%AD%E5%AE%89%E8%A3%85%20PHP%207.1%20%E7%9A%84%E9%97%AE%E9%A2%98.png)
我需要在 ubuntu 14.04 中安装 PHP 7.1。我尝试按照在线找到的分步说明进行操作:
- 首先添加存储库:
sudo add-apt-repository ppa:ondrej/php
一切似乎都正常运行,获得以下输出:
Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions
are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
You can get more information about the packages at https://deb.sury.org
BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting
CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline
or ppa:ondrej/nginx
PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/
WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
Más información: https://launchpad.net/~ondrej/+archive/ubuntu/php
Pulse [Intro] para continuar o ctrl-c para cancelar
gpg: anillo «/tmp/tmpgtjszist/secring.gpg» creado
gpg: anillo «/tmp/tmpgtjszist/pubring.gpg» creado
gpg: solicitando clave E5267A6C de hkp servidor keyserver.ubuntu.com
gpg: /tmp/tmpgtjszist/trustdb.gpg: se ha creado base de datos de confianza
gpg: clave E5267A6C: clave pública "Launchpad PPA for Ondřej Surý" importada
gpg: Cantidad total procesada: 1
gpg: importadas: 1 (RSA: 1)
OK
然后我这样做
sudo apt-get update
并注意到没有提到 ondrej 存储库。我最终尝试安装 php
sudo apt-get install php7.1
,但找不到包。
我尝试通过执行列出可用的 php 相关包,apt-cache search php7
但没有任何可用的包,只有 php5。
我很绝望。我注意到,在安装存储库时,有一个警告提到
add-apt-repository 在非 UTF-8 语言环境中无法使用
但即使我按照提供的链接中的说明操作,似乎也没有任何变化,因为事实上我的语言环境是 es_ES.UTF-8。
$ locale
LANG=es_ES.UTF-8
LANGUAGE=
LC_CTYPE="es_ES.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_COLLATE="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_MESSAGES="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"
LC_ALL=
答案1
Ubuntu14.04 已达到 EOL因此,这些软件包在 PPA 中不再可用。
不要要求终止 PHP 版本或 Ubuntu 版本,他们不会提供。
答案2
升级 Ubuntu 操作系统后,我能够安装最新版本的 PHP