在OSX上,composer自我更新失败

时间:2015-04-17 14:02:15

标签: php macos openssl composer-php

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

composer self-update

composer 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

openssl安装或证书有问题。 我该如何解决这个问题?

2 个答案:

答案 0 :(得分:5)

我建议采取以下步骤:

  1. php.ini - extension=php_openssl.so
  2. 中启用OpenSSL扩展程序
  3. 确保您在php.ini

    中配置了SSL证书
    curl.cainfo=/full/path/to/ssl/certs/ca-bundle.crt
    openssl.cafile=/full/path/to/ssl/certs/ca-bundle.crt
    

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

  4. 修改php.ini后重启PHP并尝试再次运行你的作曲家命令。

答案 1 :(得分:-3)

尝试可行的sudo composer self-update