php - composer update返回证书验证失败

时间:2016-10-26 09:26:48

标签: php laravel terminal composer-php

当我尝试composer installcomposer update时,收到一条错误消息,指出无法验证SSL证书。

  [Composer\Downloader\TransportException]                                 
  The "https://packagist.org/packages.json" file could not be downloaded:  
   SSL operation failed with code 1. OpenSSL Error messages:               
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate ver  
  ify failed                                                               
  Failed to enable crypto                                                  
  failed to open stream: operation failed  

有人知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我自己没有遇到过这种情况,但经过快速搜索后,我发现了一个潜在的解决方案(如果您使用的是PHP 5.6):

# update the ports tree (software list)
$ sudo port -v selfupdate
# install php (shortcut for compiling php with our required libs)
$ sudo port install php56
# install the mcrypt library for php
$ sudo port install php56-mcrypt
# install the curl library for php
$ sudo port install php56-curl
# configure which php version your system should use
$ sudo port select php php56

来源:https://github.com/composer/composer/issues/2798(此问题还有其他可能的解决方案。希望有所帮助!