Composer 出现error:14090086的解决方案

Published on with 0 views and 0 comments

安装一个产品时,因为产品依赖composer,所以在使用的时候出现了一个错误:

composer xxx 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

上网查了很多资料,都是让我替换php中openssl的cr证书,替换了之后重启也没有改善,最后找到了一份资料,解决方式如下:

1、输出cert信息

php -r "print_r(openssl_get_cert_locations());"

得到的结果如下:

Array
(
    [default_cert_file] => /usr/local/ssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /usr/local/ssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /usr/local/ssl/private
    [default_default_cert_area] => /usr/local/ssl
    [ini_cafile] =>
    [ini_capath] =>
)

2、下载最新的cr证书

cd ~ && wget http://curl.haxx.se/ca/cacert.pem

3、替换默认证书

默认的证书地址就是第一步中输出的default_cert_dir

mv ~/cacert.pem /usr/local/ssl/cert.pem

4、重启服务

kill -USR2 `cat /usr/local/php7/var/run/php-fpm.pid`

原文解决方案可查看Github:https://github.com/composer/composer/issues/3346


标题:Composer 出现error:14090086的解决方案
作者:M1d3r
地址:https://shaobin.wang/articles/2021/01/15/1610693272957.html