composer install或composer update 或 composer require phpoffice/phpexcel 失败解决办法

在尝试使用Composer安装或更新phpoffice/phpexcel时遇到PHP版本不兼容的问题。解决方案包括删除composer.lock文件后重新执行composer install,或者使用--ignore-platform-reqs参数忽略版本要求。另外,可以考虑手动添加Composer镜像配置信息以解决下载失败的问题。

就拿安装phpexcel为例在当前项目中的 composer.json 文件加入

composer    install 或composer update

 Problem 1
    - This package requires php >=5.6.0 but your PHP version (5.5.38) does not satisfy that requirement.
  Problem 2
    - topthink/framework v5.1.39 requires php >=5.6.0 -> your PHP version (5.5.38) does not satisfy that requirement.
    - topthink/framework v5.1.39 requires php >=5.6.0 -> your PHP version (5.5.38) does not satisfy that requirement.
    - topthink/framework v5.1.39 requires php >=5.6.0 -> your PHP version (5.5.38) does not satisfy that requirement.
    - Installation request for topthink/framework (locked at v5.1.39, required as 5.1.*) -> satisfiable by topthink/framework[v5.1.39].

 

删除 composer.lock 文件,重新执行 composer install,这样就能重新生成 composer.lock 文件了。

 

 Problem 1
    - This package requires php >=5.6.0 but your PHP version (5.5.38) does not satisfy that requirement.
  Problem 2
    - topthink/framework v5.1.39 requires php >=5.6.0 -> your PHP version (5.5.38) does not satisfy that requirement.
    - topthink/framework v5.1.39 requires php >=5.6.0 -> your PHP version (5.5.38) does not satisfy that requirement.
    - topthink/framework v5.1.39 requires php >=5.6.0 -> your PHP version (5.5.38) does not satisfy that requirement.
    - Installation request for topthink/framework (locked at v5.1.39, required as 5.1.*) -> satisfiable by topthink/framework[v5.1.39].

php版本不匹配,接着

composer install --ignore-platform-reqs     忽略版本匹配

或者composer update --ignore-platform-reqs

 

Downloading (failed)
Downloading (failed)    Failed to download phpoffice/phpexcel from dist: The "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870" file could not be downloaded: SSL: 远程主机强迫关闭了一个现有的 连接。

 

在当前项目中的 composer.json 文件的末尾自动添加镜像的配置信息(你也可以自己手工添加):

"repositories": {
    "packagist": {
        "type": "composer",
        "url": "https://packagist.phpcomposer.com"
    }
}

ok

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值