You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 20安装PHP 8.x遭遇依赖冲突问题求助

Ubuntu 20安装PHP 8.x遭遇依赖冲突问题求助

各位大佬,我在Ubuntu 20上安装PHP 8.x的时候卡壳好多次了,实在没办法来求助!

一开始我知道安装PHP需要先添加ppa:ondrej/php源,但是运行下面的命令时一直报错:

sudo add-apt-repository ppa:ondrej/php

不过这个问题后来我已经解决了。

现在当我尝试安装PHP 8.0的时候(8.1、8.2版本也试过,后面都会卡在同一个环节),运行命令:

sudo apt install php8.0 -y

会弹出下面的依赖错误:

The following packages have unmet dependencies:
php8.0 : Depends: libapache2-mod-php8.0 but it is not going to be installed or
php8.0-fpm but it is not going to be installed or
php8.0-cgi but it is not going to be installed

于是我试着单独安装libapache2-mod-php8.1,运行:

sudo apt install libapache2-mod-php8.1

结果还是报错:

The following packages have unmet dependencies:
libapache2-mod-php8.1 : Depends: php8.1-cli but it is not going to be installed
Depends: libpcre2-8-0 (>= 10.38) but 10.34-7ubuntu0.1 is to be installed

接着我又尝试安装php8.1-cli:

sudo apt install php8.1-cli

依然遇到依赖问题:

The following packages have unmet dependencies:
php8.1-cli : Depends: libpcre2-8-0 (>= 10.38) but 10.34-7ubuntu0.1 is to be installed

到这里我就彻底卡住了。我试过安装libpcre2-8-0,但系统提示已经是最新版本:

sudo apt install libpcre2-8-0

libpcre2-8-0 is already the newest version (10.34-7ubuntu0.1).

我知道这个包有更新的版本,但完全不知道该怎么在我的系统上安装新版本。

后来我甚至尝试卸载后重装libpcre2-8-0,运行:

sudo apt remove libpcre2-8-0 -f

结果反而引出了更多依赖问题:

The following packages have unmet dependencies:
libnode64 : Depends: libicu66 (>= 66.1-1~) but it is not going to be installed
Depends: libssl1.1 (>= 1.1.1) but it is not going to be installed
libxml2 : Depends: libicu66 (>= 66.1-1~) but it is not going to be installed
nginx : Depends: nginx-core (< 1.18.0-0ubuntu1.4.1~) but it is not going to be installed or
nginx-full (< 1.18.0-0ubuntu1.4.1~) but it is not going to be installed or
nginx-light (< 1.18.0-0ubuntu1.4.1~) but it is not going to be installed or
nginx-extras (< 1.18.0-0ubuntu1.4.1~) but it is not going to be installed
Depends: nginx-core (>= 1.18.0-0ubuntu1.4) but it is not going to be installed or
nginx-full (>= 1.18.0-0ubuntu1.4) but it is not going to be installed or
nginx-light (>= 1.18.0-0ubuntu1.4) but it is not going to be installed or
nginx-extras (>= 1.18.0-0ubuntu1.4) but it is not going to be installed

有没有大佬遇到过类似的问题?从这一步开始我该怎么调试和解决呢?万分感谢!

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 08:17:59