我在Windows 7上运行PHP Version 5.6.3作为XAMPP的一部分。
当我尝试使用Mandrill API时,我得到以下错误:
未捕获的异常“Mandrill_HttpError”与消息“API调用消息/发送模板失败:SSL证书问题:无法获得本地颁发者证书”
我已经尝试了我在StackOverflow上读到的所有内容,包括将以下内容添加到php.ini文件:
curl.cainfo = "C:\xampp\php\cacert.pem"
当然也下载到了cacert。来自http://curl.haxx.se/docs/caextract.html的Pem文件
但是在这之后,重新启动XAMPP和Apache服务器,但仍然得到相同的错误。
我真的不知道还能试什么。
有没有人能建议我还能尝试些什么?
如果你不能访问php.ini,添加这段代码(在$ch = curl_init();行)适合我:
$certificate_location = "C:\Program Files (x86)\EasyPHP-Devserver-16.1\ca-bundle.crt"; // modify this line accordingly (may need to be absolute)
curl_setopt($ch, CURLOPT_CAINFO, $certificate_location);
curl_setopt($ch, CURLOPT_CAPATH, $certificate_location);
然后,您只需要下载ca-bundle。CRT并保存到您在$certificate_location中指定的位置。
可能发生此错误的另一个原因是,如果CA包已从系统中删除(并且在CA -certificates中不再可用)。
这是GeoTrust全球CA目前的情况,该CA(除其他外)用于为用于推送通知的APNS签署苹果证书。
更多详细信息可以在错误报告中找到:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962596
您可以手动添加GeoTrust全球CA证书在您的机器上,建议由卡洛斯阿尔贝托洛佩兹佩雷斯:
wget --no-check-certificate -c https://www.geotrust.com/resources/root_certificates/certificates/GeoTrust_Global_CA.pem \
&& mkdir /usr/local/share/ca-certificates/extra \
&& mv GeoTrust_Global_CA.pem /usr/local/share/ca-certificates/extra/GeoTrust_Global_CA.crt \
&& update-ca-certificates