无法使用PHP 5.6.3与Composer建立SSL连接

Sto*_*nov 8 php ssl certificate composer-php

用PHP 5.6.3在Ubuntu 14.04克隆一个仓库后,我无法运行php composer.phar selfupdate既不php 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
Run Code Online (Sandbox Code Playgroud)

我认为问题应该是我本地的证书,但我无法想象如何解决它.

这是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"]
}
Run Code Online (Sandbox Code Playgroud)

Jen*_*och 11

造成这种情况的一个原因可能是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
Run Code Online (Sandbox Code Playgroud)