我正在尝试在 Ubuntu 16.04.5 LTS 上安装 php8。以下是我运行的命令和输出列表:
apt-get update
apt install software-properties-common
--- 这些命令运行时一切顺利
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
IMPORTANT: The <foo>-backports is now required on older Ubuntu releases.
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 advised 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
More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keyring `/tmp/tmpw60tb7ap/secring.gpg' created
gpg: keyring `/tmp/tmpw60tb7ap/pubring.gpg' created
gpg: requesting key E5267A6C from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpw60tb7ap/trustdb.gpg: trustdb created
gpg: key E5267A6C: public key "Launchpad PPA for Ondřej Surý" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
apt update
输出:
Hit:1 http://ppa.launchpad.net/nginx/stable/ubuntu xenial InRelease
Hit:2 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease
Hit:3 http://eu-west-2.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://eu-west-2.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:5 http://eu-west-2.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease
Ign:6 https://packages.sury.org/php xenial InRelease
Err:7 https://packages.sury.org/php xenial Release
404 Not Found
Get:8 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:9 http://repo.zabbix.com/zabbix/3.4/ubuntu xenial InRelease
Hit:10 https://packagecloud.io/phalcon/stable/ubuntu xenial InRelease
Reading package lists... Done
E: The repository 'https://packages.sury.org/php xenial Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
此后,我尝试安装 php8.0-fpm,得到以下结果:
apt install php8-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php8-fpm
还:
apt install php8.0-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php8.0-fpm
E: Couldn't find any package by glob 'php8.0-fpm'
E: Couldn't find any package by regex 'php8.0-fpm'
答案1
他们确实在您上面发布的输出中明确警告您:
仅支持 PHP 版本(http://php.net/supported-versions.php) 支持的 Ubuntu 版本 (https://wiki.ubuntu.com/Releases) 已提供。不要要求提供终止使用的 PHP 版本或 Ubuntu 版本,它们不会提供。
您不应运行 16.04,因为它已过期。请先升级到当前支持的 Ubuntu 版本,然后您才可以安装 PHP 8.0。
答案2
Xenial(Ubuntu 16)仅在 2021 年之前提供标准支持。此后,仅提供扩展的安全支持。这意味着您的服务器可以说是“处于生命支持状态”。
因此,扩展安全支持旨在保持服务器正常运行,而不是使用新功能和新软件对其进行更新。
扩展安全支持(ESM,或者现在可能称为 Ubuntu Pro)是一种“付费”支持选项。不过,您可以免费获得有限数量的安装。但它显然“并不适合所有人”。
Ondrej(Ubuntu 的 PHP 版本 PPA 存储库的维护者)不想支持超出标准支持的版本,顺便说一句,这听起来完全没问题。
因此您无法再下载任何 Xenial 软件包,因为他删除了它们。也许有人仍然在运行 Xenial 服务器,上面有他的 php8.0 软件包,但那些软件包将不会更新,因此如果您需要运行它,您可以像从源代码编译您自己的版本一样安全。
这些是选择延长支持计划的缺点。是的,您会收到一些本来会消失的安全更新。但您不应该认为您的服务器使用 ESM 后“就没问题了”。在整个 Ubuntu 社区和其他商业软件包中,您会看到 Xenial 支持被取消,即使您在未来几年仍会使用 ESM。
因此,如果确实需要,请仅使用 ESM 来推迟升级,但不要让它持续数年。