composer SSL 错误解决办法

composer self-update

报如下错误:

  [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

是因为没有找到ssl证书, 解决办法:

1、下载证书

curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/ssl/cert.pem

2、 配置 php.ini , 指定证书的路径

openssl.cafile=/usr/local/ssl/cert.pem