Composer安装失败

我正在尝试使用 PHP版本在我的 Ubuntu 16.04 </ code>中安装composer 5.6。* </代码>。 </ p>

我用过: curl -sS https://getcomposer.org/installer | PHP </代码>。 但它给我的错误如下:</ p>

 所有设置都正确使用Composer 
Downloading ...
https://getcomposer.org/versions”文件无法 下载:无法打开流:连接被拒绝
正在重试...
无法下载“https://getcomposer.org/versions”文件:SSL操作失败,代码为1. OpenSSL错误消息:
error:1416F086: SSL例程:tls_process_server_certificate:证书验证失败
无法启用加密
无法打开流:操作失败
正在重试...
无法下载“https://getcomposer.org/versions”文件:SSL操作失败并带有代码 1. OpenSSL错误消息:
error:1416F086:SSL例程:tls_process_server_certificate:证书验证失败
无法启用加密
无法打开流:操作失败
下载失败重复,中止。
</ code> </ pre>

我之前没有安装过composer。</ p>
</ div>

展开原文

原文

I'm trying to install composer in my Ubuntu 16.04 with PHP version 5.6.*.

I used: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.

5个回答

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.

Then after running sudo service apache2 restart && sudo apt install composer just worked fine.

dongxun7301
dongxun7301 更新cacert.pem文件也适合我。
2 年多之前 回复
duandgfh0506
duandgfh0506 我今天不能这样做。
2 年多之前 回复
douwen1006
douwen1006 然后将您的答案标记为已接受的答案。
2 年多之前 回复



打开终端并运行 php -r“var_dump(openssl_get_cert_locations());”</ code> </ p> \ n

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

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


nn

打开你的php.ini并添加文件的位置 openssl.cafile = cacert.pem </ code> </ p >

安装编辑器</ p>

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


</ div>

展开原文

原文

Open terminal and run php -r "var_dump(openssl_get_cert_locations());"

Note the location of default_cert_file. It might say \usr\local\ssl\cert.pem Verify that that file exists. 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

You now have a file is usr/local/ssl/cacert.pem

Open your php.ini and add the location of the file openssl.cafile=cacert.pem

Install composer

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



它看起来像是主机上PHP / openssl的错误配置。</ p>

我的工作站是Ubuntu 16.04.3,php 7.0.22和openssl-1.0.2g - 安装程序工作正常。</ p>

尝试禁用TLS:</ p>

   curl -sS https://getcomposer.org/installer |  php  -  --disable-tls 
</ code> </ pre>
</ div>

展开原文

原文

It looks like a misconfiguration of PHP/openssl on your host.

My workstation is Ubuntu 16.04.3, php 7.0.22 and openssl-1.0.2g - the installer worked fine.

Try with TLS disabled:

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



它是由我的卡巴斯基互联网安全引起的
我通过禁用KIS临时修复它</ p>

你 可以尝试一下。</ p>
</ div>

展开原文

原文

It is caused by my kaspersky internet security I fixed it by disabling KIS temporary

you can give it a try.



在我意外清空此文件的内容后,我在使用Laravel Homestead时遇到了这个问题: / etc / ssl / certs / ca-certificates.crt </ code> </ p>

为我修复的是:</ strong> </ p>

   sudo apt-get purge ca-certificates 
sudo apt-get install ca-certificates
</ code> </ pre>

感谢https://stackoverflow.com/a/53351370/470749 </ p>
</ div>

展开原文

原文

I experienced this problem while using Laravel Homestead after I’d accidentally emptied the contents of this file: /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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐