You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Ubuntu 18.04虚拟机无法安装PHP 8.1的问题求助

Ubuntu 18.04虚拟机无法安装PHP 8.1的问题求助

大家好,我在Ubuntu 18.04的虚拟机上尝试升级到PHP 8.1时遇到了问题,想请社区的各位帮忙排查一下:

我的系统环境

首先确认下系统版本:

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. 我已经添加了ondrej/php的PPA仓库:
sudo add-apt-repository ppa:ondrej/php

并且确认该PPA的列表文件存在:

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
  1. 清理缓存并更新源:
apt clean
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 8.1时,执行命令:
apt install php8.1

系统返回的内容显示只是匹配到了一堆PHP 8.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.
  • 另外,我尝试搜索可安装的PHP 8.1包,结果为空:
apt-cache search php8.1

(无任何输出)

但搜索当前已安装的PHP 7.4时,能正常看到所有相关包:

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

希望有大佬能帮我看看为什么PHP 8.1的包找不到,该怎么解决这个问题?

备注:内容来源于stack exchange,提问作者pgee70

火山引擎 最新活动