在将 Composer 安装到 XAMPP 时,我遇到了一些错误。我的系统操作系统是 Windows 7,如何解决这个问题并安装 Composer?
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 证书的路径:
curl.cainfo=/full/path/to/ssl/certs/ca-bundle.crt
openssl.cafile=/full/path/to/ssl/certs/ca-bundle.crt
如果您没有 ca 证书包,请下载它:
https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt
安装 Composer(不使用 cURL):
php -r "readfile('https://getcomposer.org/installer');"| php
或者,安装 Composer(使用 cURL):
curl -sS https://getcomposer.org/installer | php
(如果还是不行,只需通过浏览器下载 Composer PHAR。
https://getcomposer.org/composer.phar
但是,在您解决证书问题之前,您将在获取包时再次遇到问题。)
关于Composer 安装时出现 SSL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35197412/