在执行 composer install/update 时,openssl 出现以下错误:
While executing composer install/update I have got the following error from openssl:
无法下载https://packagist.org/packages.json"文件:SSL 操作失败,代码为 1.OpenSSL 错误消息:错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败无法启用加密无法打开流:操作失败https://packagist.org 无法完全加载,包信息已从本地缓存加载,可能已过期
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 https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
我正在使用:
作曲家诊断显示:
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: FAIL
[ComposerDownloaderTransportException] 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:
[作曲家下载器传输异常]
无法下载https://getcomposer.org/version"文件:SSL 操作失败,代码为 1.OpenSSL 错误消息:
错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败
无法启用加密
无法打开流:操作失败
[ComposerDownloaderTransportException]
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) ""
}
对于 php 5.5.19,一切正常.
For php 5.5.19 everything is Ok.
我找到了解决方案
我正在跑步:
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:
;openssl.cafile=
;openssl.cafile=
对此:
openssl.cafile=/usr/local/lib/perl5/site_perl/5.16/Mozilla/CA/cacert.pem
openssl.cafile=/usr/local/lib/perl5/site_perl/5.16/Mozilla/CA/cacert.pem
注意:该指令仅适用于 php 5.6.x
Note: This directive is only available on php 5.6.x
然后重启Apache
这篇关于从 packagist 更新时 Composer 更新失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!