PHP - SSL证书错误:无法获取本地颁发者证书 [英] PHP - SSL certificate error: unable to get local issuer certificate
问题描述
我在Windows 7上运行PHP版本5.6.3作为XAMPP的一部分。
当我尝试使用Mandrill API时,我得到以下错误:
未捕获异常Mandrill_HttpError,带有消息API调用消息/ send-template失败:SSL证书问题:无法获取本地发布者证书'
我已经尝试过在StackOverflow上读取的所有内容,包括添加以下内容到php.ini文件:
curl.cainfo =C:\ xampp\php\cacert.pem
且ofcourse已从 http://curl.haxx.se/docs/caextract.html
但毕竟,重新启动XAMPP和Apache服务器,但仍然获得同样的错误。
我真的不知道要尝试什么。
我可以尝试吗?
下载证书包。正如Arturo所说,获得旧的证书,以防万一你有一个新的: ca-bundle.crt
放在某处。在我的case是 c:\wamp \
目录(如果你使用Wamp 64位比它 c:\wamp64 \
)。在Apache和中启用
。但要小心,我的问题是,我有两个 mod_ssl
在 php.ini
中的php_openssl.dll php.ini
文件,我需要这两个。一个是你从WAMP任务栏图标获得的,另一个是在我的例子中,在 C:\wamp\bin\php\php5.5.12\
在 php.ini
文件中将以下行添加到您的证书:
curl.cainfo =C:/wamp/ca-bundle.crt
openssl.cafile =C:/ wamp /ca-bundle.crt
重新启动Wamp服务。
I'm running PHP Version 5.6.3 as part of XAMPP on Windows 7.
When I try to use the Mandrill API, I'm getting the following error:
Uncaught exception 'Mandrill_HttpError' with message 'API call to messages/send-template failed: SSL certificate problem: unable to get local issuer certificate'
I already tried everything I read on StackOverflow, including adding the following to the php.ini file:
curl.cainfo = "C:\xampp\php\cacert.pem"
And ofcourse downloaded to that location the cacert.pem file from http://curl.haxx.se/docs/caextract.html
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?
Finally got this to work!
Download the certificate bundle. As Arturo said, get the old cert, just in case you have a new one: ca-bundle.crt
Put it somewhere. In my case that was
c:\wamp\
directory (if you are using Wamp 64 bit than it'sc:\wamp64\
).Enable
mod_ssl
in Apache andphp_openssl.dll
inphp.ini
. But be careful, my problem was that I had twophp.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, inC:\wamp\bin\php\php5.5.12\
Add these lines to your cert in both
php.ini
files:curl.cainfo="C:/wamp/ca-bundle.crt" openssl.cafile="C:/wamp/ca-bundle.crt"
Restart Wamp services.
这篇关于PHP - SSL证书错误:无法获取本地颁发者证书的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!