【问题标题】:Install PHP 7.4 met with "unmet dependencies", how to solve this?安装 PHP 7.4 时遇到“未满足的依赖项”,如何解决?
【发布时间】:2020-11-14 00:58:27
【问题描述】:

我知道很多主题都有相同的问题,但我已经尝试了所有方法,但没有任何东西适合我。 所以我试图在我的 ubuntu 上安装 php 7.4。我已经完成了我在互联网上找到的以下命令:

apt install ca-certificates apt-transport-https wget gnupg
wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
echo "deb https://packages.sury.org/php/ buster main" | tee /etc/apt/sources.list.d/php.list
apt update
apt install php7.4

然后我得到错误:

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:
 php7.4 : Depends: libapache2-mod-php7.4 but it is not going to be installed or
                   php7.4-fpm but it is not going to be installed or
                   php7.4-cgi but it is not going to be installed
          Depends: php7.4-common but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我看到有人通过尝试安装导致问题的依赖项来跟踪错误。于是我就这样做了

apt install php7.4-common
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:
 php7.4-common : Depends: libc6 (>= 2.27) but 2.24-11+deb9u4 is to be installed
E: Unable to correct problems, you have held broken packages.

我在某处看到它可能在我的 /etc/apt/sources.list 中,所以它是:

# Generated by distrobuilder
deb http://deb.debian.org/debian stretch main
deb http://security.debian.org/debian-security stretch/updates main

我被卡住了,我看不出有什么问题。你能帮忙吗?谢谢

【问题讨论】:

    标签: installation ubuntu-20.04 php-7.4


    【解决方案1】:

    请尝试以下适用于 Ubuntu 的命令:

    sudo apt install software-properties-common
    sudo add-apt-repository ppa:ondrej/php
    sudo apt update
    

    【讨论】:

      【解决方案2】:

      如果您没有 PHP v7.4 的特定依赖项,您可以尝试安装 v7.3,这样就可以正常工作。我在我的 Kali Linux 中遇到了同样的问题,但由于我只需要 PHP 而不是特定版本,因此安装 7.3 对我有用。

      您可以通过sudo apt-get install php7.3 实现此目的

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-11-17
        • 1970-01-01
        • 1970-01-01
        • 2013-04-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多