简体   繁体   中英

How to solve PHP Error installing Composer on CentOS7

When I run sudo yum install composer on CentOS7 I get this error

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

What I've tried that haven't worked: I've tried running rpm -Va --nofiles --nodigest , I've tried running --skip-broken after the yum install, I have re-installed php, I have cleaned yum.

Here is what my php -v looks like

[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

You have multiple providers for PHP. which create conflicts, you should only use one.

  • disable webtatic
  • keep only one of remi-php7x

Run

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

Then you will be able to use PHP 7.3 and any extension

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

and to install composer of other tools from the repository.

yum install composer

As explained by the Wizard

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM