Composer安装时发生SSL错误 [英] SSL Error at Composer Install
问题描述
在将Composer安装到XAMPP时,出现了一些错误。我的系统操作系统是Windows 7,如何解决此问题并安装Composer?
While installing Composer to XAMPP, I got some errors. My system OS was Windows 7, how can I solve this and install Composer?
下载失败:file_get_contents():SSL操作失败并带有代码1. OpenSSL错误消息:
错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败
file_get_contents():无法启用加密
file_get_contents( https://getcomposer.org/composer.phar.sig ):无法打开流:操作失败
下载失败:file_get_contents( ):使用代码1的SSL操作失败。OpenSSL错误消息:
错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败
file_get_contents():无法启用加密
file_get_contents( https://getcomposer.org/composer.phar.sig ):打开流失败:操作失败
Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed file_get_contents(): Failed to enable crypto file_get_contents(https://getcomposer.org/composer.phar.sig): failed to open stream: operation failed Download failed: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed file_get_contents(): Failed to enable crypto file_get_contents(https://getcomposer.org/composer.phar.sig): failed to open stream: operation failed
推荐答案
确保在 php.ini
中配置ca证书的路径:
Make sure you configured the path to the ca certificates in php.ini
:
curl.cainfo=/full/path/to/ssl/certs/ca-bundle.crt
openssl.cafile=/full/path/to/ssl/certs/ca-bundle.crt
如果您没有ca证书包,请下载:
In case you don't have a ca certificate bundle download it:
https://raw.githubusercontent.com/cn/bagder/ca-bundle/master/ca-bundle.crt
要安装Composer(不使用cURL) :
To install Composer (without using cURL):
php -r readfile('https://getcomposer.org/installer'); | php
或者,要安装Composer(使用cURL):
Or, to install Composer (with cURL):
curl -sS https://getcomposer.org/installer | php
(如果无法解决,请通过浏览器简单下载Composer PHAR。
(If that doesn't work out, simple download the Composer PHAR via your browser.
https://getcomposer.org/composer.phar
但是,在获取软件包时,您将再次遇到问题,直到解决证书问题为止。)
But, you will run into the issue again, when fetching packages, until you fix the certificate issue.)
这篇关于Composer安装时发生SSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!