简体   繁体   English

作曲家安装失败

[英]Composer install failed

I'm trying to install composer in my Ubuntu 16.04 with PHP version 5.6.* .我正在尝试使用PHP version 5.6.*在我的Ubuntu 16.04中安装作曲家。

I used: curl -sS https://getcomposer.org/installer | php我用过: curl -sS https://getcomposer.org/installer | php curl -sS https://getcomposer.org/installer | php . curl -sS https://getcomposer.org/installer | php But it is giving me error as follows:但它给了我如下错误:

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.

I do not have composer installed previously.我以前没有安装作曲家。

I solved the issue by downloading https://curl.haxx.se/ca/cacert.pem and giving it's path in my etc/php/5.6/cli/php.ini and etc/php/5.6/apache2/php.ini .我通过下载https://curl.haxx.se/ca/cacert.pem并在我的etc/php/5.6/cli/php.inietc/php/5.6/apache2/php.ini中给出它的路径解决了这个问题.

Then after running sudo service apache2 restart && sudo apt install composer just worked fine.然后在运行sudo service apache2 restart && sudo apt install composer之后工作正常。

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

Note the location of default_cert_file .注意default_cert_file的位置。 It might say \usr\local\ssl\cert.pem Verify that that file exists.它可能会说\usr\local\ssl\cert.pem验证该文件是否存在。 If not, download the cacert.pem file from https://curl.haxx.se/ca/cacert.pem and place it in somewhere preferably in /usr/local/ssl如果没有,请从https://curl.haxx.se/ca/cacert.pem下载 cacert.pem 文件并将其放在/usr/local/ssl中的某个位置

You now have a file is usr/local/ssl/cacert.pem你现在有一个文件是usr/local/ssl/cacert.pem

Open your php.ini and add the location of the file openssl.cafile=cacert.pem打开你的 php.ini 并添加文件openssl.cafile=cacert.pem的位置

Install composer安装作曲家

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

I experienced this problem while using Laravel Homestead after I'd accidentally emptied the contents of this file: /etc/ssl/certs/ca-certificates.crt在我不小心清空了这个文件的内容后,我在使用 Laravel Homestead 时遇到了这个问题: /etc/ssl/certs/ca-certificates.crt

What fixed it for me was:为我解决的问题是:

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

Thanks to https://stackoverflow.com/a/53351370/470749感谢https://stackoverflow.com/a/53351370/470749

It looks like a misconfiguration of PHP/openssl on your host.它看起来像是您主机上的 PHP/openssl 配置错误。

My workstation is Ubuntu 16.04.3, php 7.0.22 and openssl-1.0.2g - the installer worked fine.我的工作站是 Ubuntu 16.04.3、php 7.0.22 和 openssl-1.0.2g - 安装程序运行良好。

Try with TLS disabled:尝试禁用 TLS:

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

It is caused by my kaspersky internet security I fixed it by disabling KIS temporary这是由我的卡巴斯基网络安全引起的,我通过暂时禁用 KIS 来修复它

you can give it a try.你可以试一试。

Change the Export proxy from https to http将导出代理从 https 更改为 http

Open Terminal打开终端

    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/ cmd:: https_proxy=http://192.168.0.10:8080/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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