PHP - SSL 证书错误:无法获取本地颁发者证书 [英] PHP - SSL certificate error: unable to get local issuer certificate
问题描述
我在 Windows 7 上运行 PHP 5.6.3 作为 XAMPP 的一部分.
I'm running PHP Version 5.6.3 as part of XAMPP on Windows 7.
当我尝试使用 Mandrill API 时,出现以下错误:
When I try to use the Mandrill API, I'm getting the following error:
未捕获的异常Mandrill_HttpError",消息为API 调用消息/发送模板失败:SSL 证书问题:无法获得本地颁发者证书"
Uncaught exception 'Mandrill_HttpError' with message 'API call to messages/send-template failed: SSL certificate problem: unable to get local issuer certificate'
我已经尝试了我在 StackOverflow 上阅读的所有内容,包括将以下内容添加到 php.ini 文件中:
I already tried everything I read on StackOverflow, including adding the following to the php.ini file:
curl.cainfo = "C:xamppphpcacert.pem"
当然从 http://curl.haxx.se/docs/caextract 下载 cacert.pem 文件到那个位置.html
但毕竟,重新启动了 XAMPP 和 Apache 服务器,但仍然出现相同的错误.
but after all that, restarted XAMPP and Apache server but still getting the same error.
我真的不知道还能尝试什么.
I really don't know what else to try.
谁能建议我还能尝试什么?
Can anyone advise on what else can I try?
推荐答案
终于搞定了!
下载证书包.
把它放在某个地方.就我而言,那是 c:wamp
目录(如果您使用的是 Wamp 64 位,则它是 c:wamp64
).
Put it somewhere. In my case, that was c:wamp
directory (if you are using Wamp 64 bit then it's c:wamp64
).
在 Apache 中启用 mod_ssl
和在 php.ini
中启用 php_openssl.dll
(通过删除 取消注释它们;代码>开头).但要小心,我的问题是我有两个
php.ini
文件,我需要在这两个文件中都这样做.一个是您从 WAMP 任务栏图标中获得的,另一个在我的情况下位于 C:wampinphpphp5.5.12
Enable mod_ssl
in Apache and php_openssl.dll
in php.ini
(uncomment them by removing ;
at the beginning). But be careful, my problem was that I had two php.ini
files and I need to do this in both of them. One is the one you get from your WAMP taskbar icon, and another one is, in my case, in C:wampinphpphp5.5.12
在两个 php.ini
文件中将这些行添加到您的证书中:
Add these lines to your cert in both php.ini
files:
curl.cainfo="C:/wamp/cacert.pem"
openssl.cafile="C:/wamp/cacert.pem"
重启 Wamp 服务.
Restart Wamp services.
这篇关于PHP - SSL 证书错误:无法获取本地颁发者证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!