【问题标题】:How to solve PHP Error installing Composer on CentOS7如何解决 PHP 在 CentOS7 上安装 Composer 时出错
【发布时间】:2019-04-12 18:37:36
【问题描述】:

当我在 CentOS7 上运行 sudo yum install composer 时出现此错误

Error: Package: composer-1.8.4-1.el7.noarch (epel)
   Requires: php-zip
   Available: php-common-5.4.16-46.el7.x86_64 (base)
       php-zip
   Available: php-pecl-zip-1.15.3-1.el7.remi.7.0.x86_64 (remi-php70)
   Available: php72w-common-7.2.16-1.w7.x86_64 (webtatic)
       php-zip
   Installed: php-common-7.3.4-1.el7.remi.x86_64 (@remi-php73)
       Not found
   Available: php-common-7.0.33-5.el7.remi.x86_64 (remi-php70)
       Not found
   Available: php-common-7.0.33-7.el7.remi.x86_64 (remi-php70)
       Not found
   Available: php-common-7.1.27-1.el7.remi.x86_64 (remi-php71)
       Not found
   Available: php-common-7.1.28-1.el7.remi.x86_64 (remi-php71)
       Not found
   Available: php-common-7.2.16-1.el7.remi.x86_64 (remi-php72)
       Not found
   Available: php-common-7.2.17-1.el7.remi.x86_64 (remi-php72)
       Not found
   Available: php-common-7.3.3-1.el7.remi.x86_64 (remi-php73)
       Not found
You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest

我尝试过但没有奏效的方法: 我试过运行rpm -Va --nofiles --nodigest, 我试过在 yum 安装后运行--skip-broken, 我已经重新安装了php, 我已经清理好了。

这是我的php -v 的样子

[centos@localhost etc]$ php -v
PHP 7.3.4 (cli) (built: Apr  2 2019 13:48:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.4, Copyright (c) 1999-2018, by Zend Technologies

php centos-7 yum composer

【问题讨论】:

  • 在centos上我通常只做getcomposer.org/download
  • 尝试 yum install php-pecl-zip.x86_64 或 yum install php-pecl-zip 或类似
  • 你已经从第 3 方 repo 安装了 PHP;如果该仓库不提供作曲家包,那么请遵循@Bram 的建议

标签: php composer-php centos7 yum


【解决方案1】:

您有多个 PHP 提供程序。这会产生冲突,你应该只使用一个。

  • 禁用 webtatic
  • 只保留一个remi-php7x

运行

yum-config-manager --disable webtatic
yum-config-manager --disable remi-php70
yum-config-manager --disable remi-php71
yum-config-manager --disable remi-php72

然后你就可以使用 PHP 7.3 和任何扩展了

yum-config-manager --enable remi-php73
yum install php-zip

并从存储库安装其他工具的作曲家。

yum install composer

正如Wizard所解释的那样

【讨论】:

    猜你喜欢
    • 2014-07-17
    • 2022-09-30
    • 2015-02-06
    • 2014-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-15
    • 2021-02-01
    相关资源
    最近更新 更多