【问题标题】:Package erros problem with php 7.4 install on Centos 7.8在 Centos 7.8 上安装 php 7.4 的包错误问题
【发布时间】:2023-03-25 22:20:01
【问题描述】:

我在使用 Centos 7.8 和 PHP7 时遇到问题,我浏览了 Stack Overlfow 并找到了一些类似的帖子,但我的问题没有得到答案。我有 php 5.6,当我尝试安装 php 74 时,出现以下错误。我已经尝试安装所需文件,但它只是抛出另一个错误,说它需要相同的文件。

错误:

Package: php-mcrypt-7.1.33-10.el7.remi.x86_64 (remi-php71)
           Requires: php-common(x86-64) = 7.1.33-10.el7.remi
           Removing: php-common-5.6.40-23.el7.remi.x86_64 (@remi-php56)
               php-common(x86-64) = 5.6.40-23.el7.remi
           Updated By: php-common-7.4.12-1.el7.remi.x86_64 (remi-php74)
               php-common(x86-64) = 7.4.12-1.el7.remi
           Available: php-common-5.4.16-48.el7.x86_64 (base)
               php-common(x86-64) = 5.4.16-48.el7
           Available: php-common-5.4.45-18.el7.remi.x86_64 (remi)
               php-common(x86-64) = 5.4.45-18.el7.remi
           Available: php-common-5.6.40-22.el7.remi.x86_64 (remi-php56)
               php-common(x86-64) = 5.6.40-22.el7.remi
           Available: php-common-7.1.33-9.el7.remi.x86_64 (remi-php71)
               php-common(x86-64) = 7.1.33-9.el7.remi
           Available: php-common-7.1.33-10.el7.remi.x86_64 (remi-php71)
               php-common(x86-64) = 7.1.33-10.el7.remi
           Available: php-common-7.2.33-1.el7.remi.x86_64 (remi-php72)
               php-common(x86-64) = 7.2.33-1.el7.remi
           Available: php-common-7.2.34-1.el7.remi.x86_64 (remi-php72)
               php-common(x86-64) = 7.2.34-1.el7.remi
           Available: php-common-7.3.23-1.el7.remi.x86_64 (remi-php73)
               php-common(x86-64) = 7.3.23-1.el7.remi
           Available: php-common-7.3.24-1.el7.remi.x86_64 (remi-php73)
               php-common(x86-64) = 7.3.24-1.el7.remi
           Available: php-common-7.4.11-1.el7.remi.x86_64 (remi-php74)
               php-common(x86-64) = 7.4.11-1.el7.remi
Error: Package: php-recode-7.3.24-1.el7.remi.x86_64 (remi-php73)
           Requires: php-common(x86-64) = 7.3.24-1.el7.remi
           Removing: php-common-5.6.40-23.el7.remi.x86_64 (@remi-php56)
               php-common(x86-64) = 5.6.40-23.el7.remi
           Updated By: php-common-7.4.12-1.el7.remi.x86_64 (remi-php74)
               php-common(x86-64) = 7.4.12-1.el7.remi
           Available: php-common-5.4.16-48.el7.x86_64 (base)
               php-common(x86-64) = 5.4.16-48.el7
           Available: php-common-5.4.45-18.el7.remi.x86_64 (remi)
               php-common(x86-64) = 5.4.45-18.el7.remi
           Available: php-common-5.6.40-22.el7.remi.x86_64 (remi-php56)
               php-common(x86-64) = 5.6.40-22.el7.remi
           Available: php-common-7.1.33-9.el7.remi.x86_64 (remi-php71)
               php-common(x86-64) = 7.1.33-9.el7.remi
           Available: php-common-7.1.33-10.el7.remi.x86_64 (remi-php71)
               php-common(x86-64) = 7.1.33-10.el7.remi
           Available: php-common-7.2.33-1.el7.remi.x86_64 (remi-php72)
               php-common(x86-64) = 7.2.33-1.el7.remi
           Available: php-common-7.2.34-1.el7.remi.x86_64 (remi-php72)
               php-common(x86-64) = 7.2.34-1.el7.remi
           Available: php-common-7.3.23-1.el7.remi.x86_64 (remi-php73)
               php-common(x86-64) = 7.3.23-1.el7.remi
           Available: php-common-7.3.24-1.el7.remi.x86_64 (remi-php73)
               php-common(x86-64) = 7.3.24-1.el7.remi
           Available: php-common-7.4.11-1.el7.remi.x86_64 (remi-php74)
               php-common(x86-64) = 7.4.11-1.el7.remi

【问题讨论】:

    标签: php centos7 php-7


    【解决方案1】:

    您似乎启用了各种 php 存储库(remi-php71、remi-php72...),只保留您想要的一个

    正如wizard所解释的那样

    yum-config-manager --disable 'remi-php*'
    yum-config-manager --enable   remi-php74
    

    包:php-mcrypt-7.1.33-10.el7.remi.x86_64 (remi-php71)

    mcrypt 扩展已弃用,并已从 PHP 7.2

    中删除

    另请阅读:About libmcrypt and php-mcrypt

    错误:包:php-recode-7.3.24-1.el7.remi.x86_64 (remi-php73)

    recode 扩展已被弃用,并已从 PHP 7.4

    中删除

    所以你必须在升级之前删除这些扩展,如果你“真的”需要它们,你就不能升级。

    yum remove php-recode php-mcrypt
    

    注意:php-pecl-mcrypt 和 php-pecl-recode 可用于旧版应用程序,但不鼓励使用且不受支持。

    【讨论】: