【问题标题】:OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Failed to enable cryptoOpenSSL 错误消息:错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败未能启用加密
【发布时间】:2015-11-08 06:34:45
【问题描述】:

我正在使用 OS X Yosemite

我在 Composer 中运行了以下命令,因为 Laravel 一直无法正确下载和安装:

composer diagnose

结果:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: FAIL
[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 verify failed
Failed to enable crypto
failed to open stream: operation failed
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" 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
Checking disk free space: OK
Checking composer version: 


  [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 

我要重点关注的主线是:

SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto

我该如何解决这个问题。我在网上尝试了几种解决方案,但都没有奏效。我对命令行的使用完全陌生。

使用以下命令下载和安装 Laravel 时:composer create-project laravel/laravel --prefer-dist 我不能自己手动下载东西并将其放在正确的文件夹中以避免此 SSL 问题吗?

【问题讨论】:

  • 不是重复的,而是related question 为 cUrl 设置正确选项提供了解决方案。也许你只需要修复配置。
  • 我使用的是 OS X,所以上面的 Windows 解决方案不起作用。
  • 当邮件服务器使用过期证书时,您也会收到此错误。

标签: laravel ssl composer-php


【解决方案1】:

我在 Magento 2、MAMP、Mac m1 上执行 composer install 时遇到了这个问题,在我替换路径中的文件后问题得到解决:/Applications/MAMP/Library/OpenSSL/cert.pem 使用从以下位置下载的 pem 文件: http://curl.haxx.se/docs/caextract.html

希望这可以帮助某人。

【讨论】:

  • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
【解决方案2】:

注意:我正在运行 OS X Yosemite。我相信这也适用于小牛队。

在查看了几个答案并将它们组合混合和匹配等之后。这是我所做的粗略解释。

  1. 打开命令行运行:

locate cacert.pem

这将列出您的证书所在的所有位置。

我的结果:

/Applications/Adobe Dreamweaver CS6/Configuration/Certs/cacert.pem
/Applications/MAMP/Library/lib/python2.7/test/pycacert.pem
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip/_vendor/requests/cacert.pem
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/pycacert.pem
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/test/test_asyncio/pycacert.pem
/Users/robert/.composer/cacert.pem
/opt/vagrant/embedded/cacert.pem
/usr/ssl/certs/cacert.pem
  1. 我从 curl 下载了最新的一个

http://curl.haxx.se/docs/caextract.html

  1. 我在/usr/ssl/certs/ 中创建了一个目录

并将下载的证书放在那里/usr/ssl/certs/cacert.pem

  1. 我打开了我的 php.ini 文件并将这一行放在文件的顶部: openssl.cafile=/usr/ssl/certs/cacert.pem

  2. 重启 apache(停止 apache 并重新启动)

一切都为我解决了。

现在我认为需要做的一件事是你需要告诉命令行你指的是哪个 PHP。我在 XAMPP 下运行 PHP,而不是在我的 OS X 上运行 PHP。所以命令行会认为您指的是 OS X 上的原生 PHP,而不是在 XAMPP 上运行的 PHP。我相信这需要改变才能奏效。如果没有,那应该很好。

如前所述,此解决方案对我有用。

【讨论】:

  • 太棒了,这解决了我在下载作曲家时遇到的问题。不幸的是,在使用 file_get_contents 调用 Google Maps API 时,我仍然收到此错误。
【解决方案3】:

另一个可能的原因是服务器的 SSL 证书已过期。如果它是您的服务器,请检查 /etc/apache2/ssl(对于 ubuntu)。证书通常持续 365 天。请参阅“https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04”了解如何创建。

【讨论】:

  • 我记得几分钟前科技新闻中发现 openssl 太不安全,所有证书都需要更新。我猜我的没有更新因此错误
猜你喜欢
  • 2017-05-21
  • 2020-09-20
  • 2015-08-19
  • 2015-03-30
  • 1970-01-01
  • 2018-09-13
  • 1970-01-01
  • 1970-01-01
  • 2019-12-12
相关资源
最近更新 更多