作为Windows 7上XAMPP的一部分,我正在运行PHP版本5.6.3。
当我尝试使用Mandrill API时,我会收到以下错误:
未被发现的异常“ mandrill_httperror”,带有消息'api呼叫的消息/发送 - 板呼叫失败:SSL证书问题:无法获取本地发行者证书'
我已经尝试了我在Stackoverflow上阅读的所有内容,包括将以下内容添加到php.ini文件中
curl.cainfo = "C:\xampp\php\cacert.pem"
:从 http://curl.haxx.se/caextract/caextract..html ,
但是毕竟,重新启动XAMPP和Apache服务器,但仍会遇到相同的错误。
我真的不知道还要尝试什么。
谁能建议我还能尝试什么?
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?
发布评论
评论(19)
终于让这个工作了!
下载证书捆绑包。
将其放在某个地方。就我而言,那是
c:\ wamp \
目录(如果您使用的是Wamp 64位,则是c:\ wamp64 \
)。eNable
mod_ssl
在apache中,php_openssl.dll
inphp.ini
inphp.ini
(通过删除;
在intem> in 在开始)。但是要小心,我的问题是我有两个php.ini
文件,我需要在两个文件中执行此操作。一个是您从WAMP任务栏图标中获得的一个,另一个是在我的情况下,在c:\ wamp \ bin \ php \ php \ php \ php5.5.12 \
中两个
php.ini
文件中的证书:重新启动WAMP服务。
Finally got this to work!
Download the certificate bundle.
Put it somewhere. In my case, that was
c:\wamp\
directory (if you are using Wamp 64 bit then it'sc:\wamp64\
).Enable
mod_ssl
in Apache andphp_openssl.dll
inphp.ini
(uncomment them by removing;
at the beginning). 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:Restart Wamp services.
我在第65行之后的mandrill.php文件中遇到了同样的问题,其中说$ this-> ch = curl_init();
添加以下两行:
这解决了我的问题,还使用Localhost发送了电子邮件,但我建议不要在实时版本中使用它。在您的实时服务器上,代码应在没有此代码的情况下工作。
I had the same problem in Mandrill.php file after line number 65 where it says $this->ch = curl_init();
Add following two lines:
This solved my problem and also sent email using localhost but I suggest to NOT use it on live version live. On your live server the code should work without this code.
感谢@Mladen Janjetovic,
您的建议在Mac中安装了Mac,安装了AMPP。
复制: http://curl.haxx.se/ca/ca/cacert。 pem
to:
/applications/ampps/extra/etc/openssl/certs/certs/cacert.pem
和更新
php.ini
with with那条路径和重新启动的Apache:在Windows Ampps安装中应用相同的设置,并且它也可以很好地工作。
:
对于Wamp也是如此。
如果您正在寻找使用SAN For Localhost生成新SSL证书“ rel =“ noreferrer”>这篇文章在
centos 7 / vagrant / chrome浏览器< / code>上为我工作。
Thanks @Mladen Janjetovic,
Your suggestion worked for me in mac with ampps installed.
Copied: http://curl.haxx.se/ca/cacert.pem
To:
/Applications/AMPPS/extra/etc/openssl/certs/cacert.pem
And updated
php.ini
with that path and restarted Apache:And applied same setting in windows AMPPS installation and it worked perfectly in it too.
:
Same for wamp.
If you are looking for generating new SSL certificate using SAN for localhost, steps on this post worked for me on
Centos 7 / Vagrant / Chrome Browser
.当您查看 http://curl.haxx.se/docs/docs/docs/caextract/caextract页面,您会在大写字母中注意到:
,然后下载包含“ RSA-1024”证书的证书的版本。
这些将与Mandrill一起使用。
禁用SSL是一个坏主意。
When you view the http://curl.haxx.se/docs/caextract.html page, you will notice in big letters a section called:
Read it, then download the version of the certificates that includes the 'RSA-1024' certificates.
https://github.com/bagder/ca-bundle/blob/e9175fec5d0c4d42de24ed6d84a06d504d5e5a09/ca-bundle.crt
Those will work with Mandrill.
Disabling SSL is a bad idea.
以上步骤虽然很有帮助,但在Windows 8上对我无效。我不知道共同关系,但是以下步骤奏效。基本上是cacert.pem文件的更改。希望这对某人有帮助。
openssl.cafile =“ c:\ installation_dir \ xampp \ php \ php \ cacert.pem”
根据需要的服务)。
The above steps, though helpful, didnt work for me on Windows 8. I don't know the co-relation, but the below steps worked. Basically a change in the cacert.pem file. Hope this helps someone.
http://curl.haxx.se/docs/caextract.html
openssl.cafile=”C:\Installation_Dir\xampp\php\cacert.pem”
services as needed).
我找到了没有任何必需认证的新解决方案,只能添加两个行代码。
I found new Solution without any required certification to call curl only add two line code.
如果您无法访问 php.ini ,请添加此代码(在您的
$ ch = curl_init();
line之后)适用于我:然后,您只会需要下载 $ CESTICT_LOCATION 中指定的位置。
If you don't have access to php.ini, adding this code (after your
$ch = curl_init();
line) works for me:Then, you will just need to download ca-bundle.crt and save it to location you specified in
$certificate_location
.我尝试了它
开放
并将其更改
为此
I tried this it works
open
and change this
to this
详细说明服务器部署的上述答案。
在部署时,应该为开发环境做一个问题,而不会损害服务器。
elaborating on the above answers for server deployment.
should do the trick for development environment without compromising the server when deployed.
解决方案修订。
我在我的本地系统中遇到了这样的问题,但在实时服务器中却没有。我之前在此页面上也提到了另一个解决方案,但这在 localhost 中都没有起作用。
因此,请遵循下面提到的步骤。
步骤1。 您可以从此处下载证书捆绑文件。 [https://curl.haxx.se/docs/caextract.html]
在我的身边,我的 wamp安装在f:\ wamp64 \目录(如果您使用的是Wamp 64位,则是f:\ wamp64)。
第2步
。强>在两个php.ini文件中将这些行添加到您的证书中:
重新启动WAMP服务。
Solution Revised.
I was facing a problem like this in my local system but not in the live server. I also mentioned another solution on this page before, but that was not working in localhost.so find a new solution for this, that is working in the localhost-WAMP Server.
So for this follow the steps mentioned below.
Step 1. You can download the certificate bundle file from here. [https://curl.haxx.se/docs/caextract.html]
On my side, my WAMP was installed on the F:\wamp64\ directory (if you are using Wamp 64-bit then it's F:\wamp64).
Step 2. To enable mod_ssl in Apache and php_openssl.dll in php.ini uncomment them by removing ;
Step 3. Add these lines to your cert in both php.ini files:
Restart Wamp services.
我对这个问题有适当的解决方案,让我们尝试理解此问题的根本原因。当无法使用系统证书存储中的根证书或远程SSL与链证书一起使用远程服务器SSL验证远程服务器SSL时,此问题就会出现。如果您的Linux系统具有root ssh访问权限,则可以尝试使用以下命令更新证书存储:
update-ca-cectificates
如果仍然't工作,然后您需要在证书存储中添加远程服务器的根和临时证书。您可以下载root和中级证书,然后将其添加到 /usr/local/local/share/ca-certificates 目录中,然后运行命令
update> update> update-ca--证书
。这应该解决问题。同样,对于Windows,您可以搜索如何添加根和中间证书。您可以解决此问题的另一种方法是要求远程服务器团队将SSL证书添加为域根证书,中级证书和根证书。
I have a proper solution of this problem, lets try and understand the root cause of this issue. This issue comes when remote servers ssl cannot be verified using root certificates in your system's certificate store or remote ssl is not installed along with chain certificates. If you have a linux system with root ssh access, then in this case you can try updating your certificate store with below command:
update-ca-certificates
If still, it doesn't work then you need to add root and interim certificate of remote server in your cert store. You can download root and intermediate certs and add them in /usr/local/share/ca-certificates directory and then run command
update-ca-certificates
. This should do the trick. Similarly for windows you can search how to add root and intermediate cert.The other way you can solve this problem is by asking remote server team to add ssl certificate as a bundle of domain root cert, intermediate cert and root cert.
在Amazon Linux(Centos / Red Hat等)上,我做了以下操作来解决此问题。首先复制从并将其放入
/etc/pki/pki/ca-trust/source/aNchors/
目录中。然后运行update-ca-trust
命令。这是一个从 https://serverfault.com/questions.com/questions.com /394815/how-to-update-curl-ca-bundle-on-redhat
curl https://curl.se/ca/ca/cacert.pem-o/o/etc/pki/ca-trust/源/锚/curl-cacert upded.pem&amp;&amp; 但是, update-ca-trust
由于curl被打破,因此实际上使用此命令下载cacert.pem文件。
wget -no-check-certificate http://curl.haxx.se/ca/cacert.pem
在运行
update> update> update> code> update-ca-trust
命令后,您可以重新启动Web服务器服务httpd restart
for apache或nginx restart
for Nginx。On Amazon Linux (CentOS / Red Hat etc) I did the following to fix this issue. First copy the cacert.pem downloaded from http://curl.haxx.se/ca/cacert.pem and put it in the
/etc/pki/ca-trust/source/anchors/
directory. Then run theupdate-ca-trust
command.Here is a one liner taken from 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
However since curl was broken I actually used this command to download the cacert.pem file.
wget --no-check-certificate http://curl.haxx.se/ca/cacert.pem
After running the
update-ca-trust
command you can restart the web serverservice httpd restart
for apache orservice nginx restart
for nginx.在Appveyor构建应用程序时,我遇到了同样的问题。
echo扩展= php_openssl.dll&gt;&gt; C:\ php \ php.ini
echo curl.cainfo = c:\ php \ cacert.pem&gt;&gt;&gt; C:\ php \ php.ini
I had the same issue during building my app in AppVeyor.
c:\php
echo extension=php_openssl.dll >> c:\php\php.ini
echo curl.cainfo=c:\php\cacert.pem >> c:\php\php.ini
可能发生此错误的另一个原因是,如果从系统中删除了CA捆绑包(并且不再在CA-CECETICATES中可用)。
目前,这是Geotrust Global CA的情况,该情况(除其他外)被用来签署用于推送通知的APN证书。
其他详细信息可以在此处的错误报告上找到:
Another reason this error can occur is if a CA bundle has been removed from your system (and is no longer available in ca-certificates).
This is currently the situation with the GeoTrust Global CA which (among other things) is used to sign Apple's certificate for APNS used for Push Notifications.
Additional details can be found on the bug report here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962596
You can manually add the GeoTrust Global CA certificate on your machine as suggested by Carlos Alberto Lopez Perez:
如果上面的解决方案都不适用,则尝试将XAMPP安装更新为较新版本。
我正在使用PHP 5.5.11运行XAMPP,相同的确切代码不起作用,我以PHP 5.6.28升级到XAMPP,上面的解决方案工作。
此外,只有更新PHP也无法正常工作,似乎是该版本的XAMPP上的Apache和PHP设置的组合。
希望它对某人有帮助。
If none of the solutions above are working for you try updating your XAMPP installation to a newer version.
I was running XAMPP with php 5.5.11, the same exact code didn't work, I upgraded to XAMPP with php 5.6.28 and the solutions above worked.
Additionally only updating PHP didn't work either seems like a combination of apache and php settings on that version of XAMPP.
Hope it helps someone.
我有错误的错误:
我正在使用Windows Machine。所以我遵循以下步骤。
希望它可以帮助某人
I got the error like :
I am using windows machine. So I followed the below steps.
Hope it may help someone
只需在本地再加两行即可解决这个问题,这对我来说很好。
simply put two more line on local to solve the issue and this worked for me fine.
curl_setopt($ ch,curlopt_ssl_verifypeer,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
对于Guzzle,您可以尝试以下操作:
在Guzzle/Guzzle 3上进行测试3.**
for guzzle you can try this :
tested on guzzle/guzzle 3.*