无法在 18.04 上安装 php8.1

无法在 18.04 上安装 php8.1

我在虚拟机上安装了 18.04。我想更新到 php8.1

我的机器上已经有 PPA php 存储库: sudo add-apt-repository ppa:ondrej/php

我可以看到有一个文件:

# ls -l /var/lib/apt/lists/ppa.launchpad.net_on*
-rw-r--r-- 1 root root 20811 Jun 15 21:41 /var/lib/apt/lists/ppa.launchpad.net_ondrej_php_ubuntu_dists_bionic_InRelease

我努力了:

root@prod:~# apt clean
root@prod:~# apt update
Hit:1 http://mirror.binarylane.com.au/ubuntu bionic InRelease
Hit:2 http://mirror.binarylane.com.au/ubuntu bionic-updates InRelease
Hit:3 http://mirror.binarylane.com.au/ubuntu bionic-backports InRelease
Hit:4 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:6 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:7 http://ppa.launchpad.net/maxmind/ppa/ubuntu bionic InRelease
Hit:8 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Fetched 88.7 kB in 2s (46.0 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

但是当我输入预期的命令来安装 php 时它不起作用。

root@prod:~# apt install php8.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php8.1-mysql' for regex 'php8.1'
Note, selecting 'php8.1-gettext' for regex 'php8.1'
Note, selecting 'php8.1-common' for regex 'php8.1'
Note, selecting 'php8.1-imagick' for regex 'php8.1'
Note, selecting 'php8.1-calendar' for regex 'php8.1'
Note, selecting 'php8.1-fileinfo' for regex 'php8.1'
Note, selecting 'php8.1-exif' for regex 'php8.1'
Note, selecting 'php8.1-posix' for regex 'php8.1'
Note, selecting 'php8.1-iconv' for regex 'php8.1'
Note, selecting 'php8.1-sockets' for regex 'php8.1'
Note, selecting 'php8.1-mysqli' for regex 'php8.1'
Note, selecting 'php8.1-sysvmsg' for regex 'php8.1'
Note, selecting 'php8.1-pdo-mysql' for regex 'php8.1'
Note, selecting 'php8.1-mbstring' for regex 'php8.1'
Note, selecting 'php8.1-readline' for regex 'php8.1'
Note, selecting 'php8.1-opcache' for regex 'php8.1'
Note, selecting 'php8.1-sysvsem' for regex 'php8.1'
Note, selecting 'php8.1-sysvshm' for regex 'php8.1'
Note, selecting 'php8.1-tokenizer' for regex 'php8.1'
Note, selecting 'php8.1-cli' for regex 'php8.1'
Note, selecting 'php8.1-shmop' for regex 'php8.1'
Note, selecting 'php8.1-ffi' for regex 'php8.1'
Note, selecting 'php8.1-ftp' for regex 'php8.1'
Note, selecting 'php8.1-ctype' for regex 'php8.1'
Note, selecting 'php8.1-json' for regex 'php8.1'
Note, selecting 'php8.1-phar' for regex 'php8.1'
Note, selecting 'php8.1-mysqlnd' for regex 'php8.1'
Note, selecting 'libapache2-mod-php8.1' for regex 'php8.1'
Note, selecting 'php8.1-pdo' for regex 'php8.1'
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

当我搜索可安装的 php8.1 时,什么也没找到,但当前已安装的 php7.4 就在那里:

root@prod:~# apt-cache search php8.1
root@prod:~# apt-cache search php7.4
php7.4-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.4-common - documentation, examples and common module for PHP
libapache2-mod-php7.4 - server-side, HTML-embedded scripting language (Apache 2 module)
php7.4-opcache - Zend OpCache module for PHP
php7.4-zip - Zip module for PHP
php7.4-bz2 - bzip2 module for PHP
php7.4-soap - SOAP module for PHP
php7.4-ldap - LDAP module for PHP
php7.4-cli - command-line interpreter for the PHP scripting language
php7.4-gd - GD module for PHP
php7.4 - server-side, HTML-embedded scripting language (metapackage)
php7.4-mysql - MySQL module for PHP
php7.4-imap - IMAP module for PHP
php7.4-mbstring - MBSTRING module for PHP
php7.4-curl - CURL module for PHP
php7.4-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.4-gmp - GMP module for PHP
php7.4-readline - readline module for PHP
php7.4-intl - Internationalisation module for PHP
php7.4-xmlrpc - XMLRPC-EPI module for PHP
php7.4-xml - DOM, SimpleXML, XML, and XSL module for PHP
php7.4-json - JSON module for PHP

cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

答案1

2023 年 6 月 15 日,Ondřej Surý 的 PPA 中不再支持 Ubuntu 18.04,因为该版本的 Ubuntu 不再受支持。根据PPA 登陆页面上的描述

... 仅支持 PHP 版本 (http://php.net/supported-versions.php) 支持的 Ubuntu 版本 (https://wiki.ubuntu.com/Releases) 已提供。不要要求提供终止使用的 PHP 版本或 Ubuntu 版本,它们不会提供。

如果你真的必须在 Ubuntu 18.04 服务器上使用 PHP 8.1,那么你唯一的半支撑前进的道路是使用 Docker 容器。但是,如果 Docker 不再为 18.04 提供其工具,那么您需要考虑从 18.04 更新到更新的版本。

相关内容