laravel OpenSSL 错误消息:错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败无法启用加密
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32019623/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed Failed to enable crypto
提问by Robert Rocha
I am using OS X Yosemite
我正在使用 OS X Yosemite
I ran the following command in Composer because Laravel fails to download and install properly all the time:
我在 Composer 中运行了以下命令,因为 Laravel 始终无法正确下载和安装:
composer diagnose
composer diagnose
result:
结果:
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
The main line I want to focus on is:
我想关注的主线是:
SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
How can I fix this. I have tried several solutions on the web and none have worked. I am totally new to the use of the command line.
我怎样才能解决这个问题。我在网上尝试了几种解决方案,但都没有奏效。我对命令行的使用完全陌生。
When downloading and installing Laravel with the following command: composer create-project laravel/laravel --prefer-dist
can't I just manually download the stuff myself and place it in the correct folder to avoid this SSL problem?
使用以下命令下载和安装 Laravel 时:composer create-project laravel/laravel --prefer-dist
我不能自己手动下载这些东西并将其放在正确的文件夹中以避免此 SSL 问题吗?
回答by Robert Rocha
Note: I am running OS X Yosemite. I believe this works with Mavericks too.
注意:我正在运行 OS X Yosemite。我相信这也适用于小牛队。
After looking a several answers and combining them mixing and matching etc. Here is a rough explanation on what I did.
在查看了几个答案并将它们混合和匹配等之后,这是对我所做的事情的粗略解释。
- Open the command line and run:
- 打开命令行并运行:
locate cacert.pem
locate cacert.pem
This will list all the locations where your certificates are.
这将列出您的证书所在的所有位置。
My result:
我的结果:
/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
- I downloaded the most recent one from curl
- 我从 curl 下载了最新的
http://curl.haxx.se/docs/caextract.html
http://curl.haxx.se/docs/caextract.html
- I made a directory in
/usr/ssl/certs/
- 我做了一个目录
/usr/ssl/certs/
and put the downloaded cert there /usr/ssl/certs/cacert.pem
并将下载的证书放在那里 /usr/ssl/certs/cacert.pem
I opened up my php.ini file and placed this line at the top of the file:
openssl.cafile=/usr/ssl/certs/cacert.pem
Restart apache (stop apache and start it again)
我打开了我的 php.ini 文件并将这一行放在文件的顶部:
openssl.cafile=/usr/ssl/certs/cacert.pem
重启apache(停止apache并重新启动)
Everything worked out for me.
一切都对我有用。
Now one thing that I do believe needs to be done is you need to tell the command line which PHP you are referring to. I am running PHP under XAMPP and not natively on my OS X. So the command line will think that you are referring to the native PHP on OS X and not the one running on XAMPP. This needs to be changed I believe for this to work. If not then it should be good.
现在我认为需要做的一件事是您需要告诉命令行您指的是哪个 PHP。我在 XAMPP 下运行 PHP,而不是在我的 OS X 上运行。所以命令行会认为您指的是 OS X 上的本机 PHP,而不是在 XAMPP 上运行的 PHP。我相信这需要改变才能起作用。如果没有,那么它应该是好的。
As mentioned this solution worked for me.
如前所述,此解决方案对我有用。
回答by Britc
Another possible reason is that the server's SSL cert has expired. If it is your server, check the /etc/apache2/ssl (for ubuntu). The certs usually last for 365 days. See 'https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04' on how to create one.
另一个可能的原因是服务器的 SSL 证书已过期。如果是您的服务器,请检查 /etc/apache2/ssl(对于 ubuntu)。证书通常持续 365 天。有关如何创建一个,请参阅“ https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04”。