我在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服务器,但仍然得到相同的错误。
我真的不知道还能试什么。
有没有人能建议我还能尝试些什么?
谢谢@Mladen Janjetovic,
你的建议在安装了放大器的mac上对我有用。
复制:http://curl.haxx.se/ca/cacert.pem
: /应用程序/ ampp /额外的/ etc / openssl /组/ cacert.pem
用这个路径更新php.ini并重新启动Apache:
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo="/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem"
openssl.cafile="/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem"
并在windows AMPPS安装中应用了相同的设置,效果也很好。
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo="C:/Ampps/php/extras/ssl/cacert.pem"
openssl.cafile="C:/Ampps/php/extras/ssl/cacert.pem"
:
wamp也是一样。
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo="C:/wamp/bin/php/php5.6.16/extras/ssl/cacert.pem"
openssl.cafile="C:/wamp/bin/php/php5.6.16/extras/ssl/cacert.pem"
如果您正在寻找使用SAN为localhost生成新的SSL证书,那么本文中的步骤在Centos 7 / Vagrant / Chrome浏览器上对我有效。
可能发生此错误的另一个原因是,如果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
在亚马逊Linux (CentOS / Red Hat等)上,我做了以下工作来解决这个问题。首先复制cacert。Pem从http://curl.haxx.se/ca/cacert.pem下载,放在/etc/pki/ca-trust/source/anchors/目录下。执行update-ca-trust命令。
下面是来自https://serverfault.com/questions/394815/how-to-update-curl-ca-bundle-on-redhat的一句话
Curl https://curl.se/ca/cacert.pem -o /etc/pki/ca-trust/source/anchors/curl-cacert-updated。Pem && update-ca-trust
然而,由于curl被破坏,我实际上使用这个命令来下载cacert。pem文件。
Wget——no-check-certificate http://curl.haxx.se/ca/cacert.pem
执行update-ca-trust命令后,可以重新启动web服务器服务httpd restart (apache)或service nginx restart (nginx)。