作曲家安装失败

Composer install failed

我正在尝试使用 PHP version 5.6.* 在我的 Ubuntu 16.04 中安装作曲家。

我用过:curl -sS https://getcomposer.org/installer | php。但它给我的错误如下:

All settings correct for using Composer
Downloading...
The "https://getcomposer.org/versions" file could not be downloaded: failed to open stream: Connection refused
Retrying...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Retrying...
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
The download failed repeatedly, aborting.

我之前没有安装composer。

您主机上的 PHP/openssl 似乎配置错​​误。

我的工作站是 Ubuntu 16.04.3、php 7.0.22 和 openssl-1.0.2g - 安装程序工作正常。

尝试禁用 TLS:

curl -sS https://getcomposer.org/installer | php -- --disable-tls

我通过下载 https://curl.haxx.se/ca/cacert.pem 并在我的 etc/php/5.6/cli/php.inietc/php/5.6/apache2/php.ini 中给出它的路径解决了这个问题。

然后在 运行 sudo service apache2 restart && sudo apt install composer 之后工作正常。

是我的卡巴斯基安全软件引起的 我通过临时禁用 KIS 来修复它

你可以试试看

打开终端并运行php -r "var_dump(openssl_get_cert_locations());"

记下 default_cert_file 的位置。它可能会说 \usr\local\ssl\cert.pem 验证该文件是否存在。如果没有,请从 https://curl.haxx.se/ca/cacert.pem 下载 cacert.pem 文件并将其放置在 /usr/local/ssl

中的某个位置

你现在有一个文件是usr/local/ssl/cacert.pem

打开您的 php.ini 并添加文件的位置 openssl.cafile=cacert.pem

安装作曲家

运行 composer config --global cafile "/usr/local/ssl/cacert.pem"

我在使用 Laravel Homestead 时遇到了这个问题,因为我不小心清空了这个文件的内容:/etc/ssl/certs/ca-certificates.crt

为我修复的是:

sudo apt-get purge ca-certificates 
sudo apt-get install ca-certificates

感谢

将导出代理从 https 更改为 http

打开终端

    echo $https_proxy
// Change export proxy from 
    https_proxy=https://192.168.0.10:8080/
// to 
   https_proxy=http://192.168.0.10:8080/

cmd::https_proxy=http://192.168.0.10:8080/