首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法更正问题,在尝试安装PHP时,您已保存了损坏的软件包

无法更正问题,在尝试安装PHP时,您已保存了损坏的软件包
EN

Ask Ubuntu用户
提问于 2022-04-26 21:13:33
回答 2查看 8.3K关注 0票数 1

我刚开始使用Ubuntu,我试着安装PHP,这样我就可以在PHPStorm中使用解释器了。

我使用的命令: sudo apt-get更新sudo apt install php。

然后,我得到以下错误

代码语言:javascript
复制
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 php : Depends: php8.1 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

想知道有没有人能帮上忙?

sudo apt更新:

代码语言:javascript
复制
Hit:1 http://gb.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]      
Hit:3 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease               
Get:4 http://gb.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]     
Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease                  
Get:6 http://gb.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Hit:7 https://deb.nodesource.com/node_16.x focal InRelease
Get:8 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [40.8 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [66.6 kB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:11 http://gb.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [278 kB]
Get:12 http://gb.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [390 kB]
Get:13 http://gb.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [944 B]
Get:14 http://gb.archive.ubuntu.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [7,980 B]
Get:15 http://gb.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30.8 kB]
Fetched 1,154 kB in 1s (1,216 kB/s)                                          
Reading package lists... Done
Building dependency tree       
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
EN

回答 2

Ask Ubuntu用户

回答已采纳

发布于 2022-06-14 17:58:21

在安装了add-apt-repository ppa:ondrej/php PPA并更新了存储库(sudo apt update)之后,我无法在Ubuntu20.04.4LTS上安装PHP8.1:

代码语言:javascript
复制
The following packages have unmet dependencies:
 php8.1 : Depends: libapache2-mod-php8.1 but it is not going to be installed or
                   php8.1-fpm but it is not going to be installed or
                   php8.1-cgi but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我终于取得了以下成绩:

  1. sudo apt remove php但got 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-7 is to be installed E: Unable to correct problems, you have held broken packages.
  2. 所以我用sudo apt install libpcre2-8-0安装了这个依赖程序
  3. 最后是sudo apt install php8.1

结果是

代码语言:javascript
复制
$ php -v
PHP 8.1.7 (cli) (built: Jun 10 2022 12:22:48) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.7, Copyright (c), by Zend Technologies
票数 1
EN

Ask Ubuntu用户

发布于 2022-12-26 13:13:37

然后我使用了>sudo apt安装aptitude<

数独天资-f<对救援的能力

票数 -1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1404869

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档