PHP Composer 出现error:14090086的解决步骤

报错
  [Composer\Downloader\TransportException]
  The "https://packagist.laravel-china.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
原因

如果报错原因所示,是链接 xxx composer 资源库的时候, “certificate verify failed” 证书验证有误;

解决思路

获取新的证书,并且覆盖即可

获取php的证书信息
php -r "print_r(openssl_get_cert_locations());"
证书存放的路径 default_cert_file => /private/etc/ssl/cert.pem
Array
(
    [default_cert_file] => /private/etc/ssl/cert.pem
    [default_cert_file_env] => SSL_CERT_FILE
    [default_cert_dir] => /private/etc/ssl/certs
    [default_cert_dir_env] => SSL_CERT_DIR
    [default_private_dir] => /private/etc/ssl/private
    [default_default_cert_area] => /private/etc/ssl
    [ini_cafile] =>
    [ini_capath] =>
)
生成最新的证书
cd ~ && wget http://curl.haxx.se/ca/cacert.pem
将新的证书覆盖到旧的证书即可
mv ~/cacert.pem /private/etc/ssl/cert.pem
posted @ 2020-04-03 22:01  五个平均值  阅读(695)  评论(0编辑  收藏  举报