在OSX上,composer自我更新失败

Art*_*n72 3 php macos openssl composer-php

在OSX系统上,安装了XAMPP,PHP 5.6.3.

composer self-update
Run Code Online (Sandbox Code Playgroud)

composer update
Run Code Online (Sandbox Code Playgroud)

失败的消息:

[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
Run Code Online (Sandbox Code Playgroud)

openssl安装或证书有问题.我怎样才能解决这个问题?

Jen*_*och 5

我建议采取以下步骤:

  1. 启用OpenSSL扩展php.ini-extension=php_openssl.so
  2. 确保您已配置SSL证书 php.ini

    curl.cainfo=/full/path/to/ssl/certs/ca-bundle.crt
    openssl.cafile=/full/path/to/ssl/certs/ca-bundle.crt
    
    Run Code Online (Sandbox Code Playgroud)

    如果缺少证书,请下载http://curl.haxx.se/ca/cacert.pem并重命名为ca-bundle.crt

修改php.ini后重新启动PHP并尝试再次运行composer命令.