【问题标题】:Cannot establish SSL connection with Composer with PHP 5.6.3无法使用 PHP 5.6.3 与 Composer 建立 SSL 连接
【发布时间】:2015-04-01 18:08:52
【问题描述】:

使用 PHP 5.6.3 在 Ubuntu 14.04 上克隆存储库后,我无法运行 php composer.phar selfupdatephp composer.phar update。我收到这条消息:

  [Composer\Downloader\TransportException]                                     
  The "https://getcomposer.org/version" file could not be downloaded: SSL ope  
  ration 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

我认为问题应该与我在本地拥有的证书有关,但我无法想象如何解决它。

这是composer.json:

{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
    "framework",
    "zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
    "php": ">=5.3.3",
    "zendframework/zendframework": "2.3.*",
    "evandotpro/edp-module-layouts": "1.*",
    "tecnick.com/tcpdf": "~6.0@stable",
    "phpoffice/phpexcel": "1.7.*"
},
"require-dev": {
    "phpunit/phpunit": "4.1.*",
    "phpunit/phpunit-selenium": ">=1.2"
},
"autoload": {
    "psr-0": {"BOZA\\": "vendor/BOZA/"},
    "classmap": ["vendor/tecnick.com/tcpdf"]
}

【问题讨论】:

    标签: php ssl certificate composer-php


    【解决方案1】:

    对于类似的ssl连接错误

    错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:证书

    Here 是我解决它的方法。

    【讨论】:

      【解决方案2】:

      您可以下载此 pem 文件:

      http://curl.haxx.se/ca/cacert.pem

      然后在 php.ini 中定位,例如:

      openssl.cafile=/usr/local/etc/openssl/cacert.pem
      

      参考:http://akrabat.com/ssl-certificate-verification-on-php-5-6/

      【讨论】:

        【解决方案3】:

        其中一个原因可能是证书丢失或 PHP 找不到。

        是否安装了ca-certificates 软件包?

        如果不是:apt-get install ca-certificates 或直接从这里下载证书包:

        然后检查并编辑您的php.ini,以便这些证书用于 PHP 建立的 SSL 连接。

        curl.cainfo=/path/to/ssl/certs/ca-bundle.crt
        openssl.cafile=/path/to/ssl/certs/ca-bundle.crt
        

        【讨论】:

        • 感谢一百万!证书存在,但路径修复了它。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-01
        • 1970-01-01
        • 2022-01-24
        相关资源
        最近更新 更多