问题描述
执行composer安装/更新时,我从openssl得到以下错误:
While executing composer install/update I have got the following error from openssl:
我使用的是:
- PHP 5.6.3(cli) :16:53)
- XAMPP协议栈5.6.3-0
- ubuntu 14.04
composer diag显示:
composer diag shows:
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Checking disk free space: OK
Checking composer version:
[Composer\ Downloader\TransportException]
文件无法下载:SSL操作失败,代码为1. OpenSSL错误消息:
错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败
无法启用加密
无法打开流:操作失败
[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
php -r'var_dump(openssl_get_cert_locations());'显示:
php -r 'var_dump(openssl_get_cert_locations());' shows:
array(8) {
["default_cert_file"]=>
string(33) "/opt/lampp/share/openssl/cert.pem"
["default_cert_file_env"]=>
string(13) "SSL_CERT_FILE"
["default_cert_dir"]=>
string(30) "/opt/lampp/share/openssl/certs"
["default_cert_dir_env"]=>
string(12) "SSL_CERT_DIR"
["default_private_dir"]=>
string(32) "/opt/lampp/share/openssl/private"
["default_default_cert_area"]=>
string(24) "/opt/lampp/share/openssl"
["ini_cafile"]=>
string(0) ""
["ini_capath"]=>
string(0) ""
}
是好的。
推荐答案
我找到了一个解决方案
'm running:
FreeBSD 10.1
Apache2.4
PHP 5.6.3
I'm running:
FreeBSD 10.1
Apache2.4
PHP 5.6.3
找到CA文件我运行此命令
To find the CA file I ran this command
>找到cacert.pem
结果是:
/usr/local/lib/perl5/site_perl/5.16/Mozilla /CA/cacert.pem
Result was:
/usr/local/lib/perl5/site_perl/5.16/Mozilla/CA/cacert.pem
然后打开php.ini文件和
更改此:
Then open the php.ini file and
change this:
至此:
注意:此指令仅适用于php 5.6.x
Note: This directive is only available on php 5.6.x
然后重新启动Apache
Then restart Apache
这篇关于从packagist更新时,Composer更新失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!