centos 上安装composer失败

服务器上安装composer总是失败,貌似是验证失败,不知道该怎么解决。我是按照官方文档操作的,过程如下:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php

执行到这里之后就不行了,报如下错误

Downloading...
Signature mismatch, could not verify the phar file integrity
Retrying...

过一会之后错误信息变成下面这样

Downloading...
Signature mismatch, could not verify the phar file integrity
Retrying...
The "https://getcomposer.org/download/1.4.1/composer.phar" file could not be downloaded: >failed to open stream: HTTP request failed!
Retrying...
Signature mismatch, could not verify the phar file integrity
The download failed repeatedly, aborting.

然后就停止了。好无奈,试了很多遍都一样。
我直接下载执行文件(composer.phar)倒是可以执行,但是好像就不能全局安装了,所以还是想按照文档上的方式执行成功,不知道我该如何解决!

阅读 6.3k
2 个回答

下载composer

wget https://getcomposer.org/composer.phar

安装

cp composer.phar /usr/local/bin/composer
chmod u+x /usr/local/bin/composer

测试

composer --help

安装的时候用root用户,使用的时候用非root用户

手动安装就行了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题