解决安装 composer 时 openssl 问题

  • 确认本地使用证书路径
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    $ 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] =>
    )
  • 下载最新 curl 证书
    1
    $ wget http://curl.haxx.se/ca/cacert.pem
  • 替换原证书路径文件
    1
    $ sudo mv cacert.pem /usrlocal/ssl/cert.pem
  • 重启 php-fpm
    1
    $ service php-fpm restart
  • 重新安装 composer,正常