【问题标题】:Mandrill CA SSL errors with cURLMandrill CA SSL 错误与 cURL
【发布时间】:2014-11-26 21:17:15
【问题描述】:

我正在尝试 Mandrill。看起来很好。我注册了一个帐户并获得了一个 api 密钥。从下载 Mandrill PHP 包装器 https://bitbucket.org/mailchimp/mandrill-api-php

这篇文章似乎有一个很好的 hello-world Mandrill 电子邮件示例,所以我试了一下:

Simple php function to send an email with Mandrill

不断收到此错误:

API call to templates/add failed: Problem with the SSL CA cert (path? access rights?)

我按照这些 S.O. 的指示进行操作。帖子:

error in send email using Mandrill (php) HTTPS and SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK

http://curl.haxx.se/docs/caextract.html获取.pem文件

并确保 curl api 指向 Mandrill api 中的那个文件

curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, TRUE); 
curl_setopt ($ch, CURLOPT_CAINFO, "pathto/cacert.pem");

.pem 文件是可读的。没有疯狂的权限情况。

没有帮助。同样的交易:

API call to templates/add failed: Problem with the SSL CA cert (path? access rights?)

谷歌搜索我在这里遵循 CentOS 6.0 步骤: http://kb.kerio.com/product/kerio-connect/server-configuration/ssl-certificates/adding-trusted-root-certificates-to-the-server-1605.html

以及这里的步骤: http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/

同样的错误。作为最后一次尝试,我将 curl 设置为完全忽略 ssl 步骤。当然不建议这样做,但我只是想在我的脚下感受坚实的地面。我回到 Mandrill.php 并试了一下。

curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);

同样的错误。我想知道是否其他人可以为我阐明这一点。我已经用尽了谷歌。 (它给了我一个recaptcha,因为我使用它太多了)。感谢您的宝贵时间!

(系统:CentOS 6.5,PHP 5.3)

【问题讨论】:

    标签: php ssl curl mandrill


    【解决方案1】:

    奇怪的是,您在 Linux 上遇到了这个问题(虽然在 Windows 中是已知问题)。

    我唯一想到的是,您尝试通过 php.ini 文件将 .pem 作为默认值加载,检查 curl.cainfo 并提供 cacert.pem 文件的绝对路径。这样您就不必使用 CURLOPT_CAINFO 了——也许会得到更好的结果?

    跑题了;如果您不需要 API 提供的所有功能,您也可以使用 SMTP 连接(总是更容易使用)。

    【讨论】:

      猜你喜欢
      • 2012-12-30
      • 2017-12-11
      • 2021-10-04
      • 1970-01-01
      • 1970-01-01
      • 2013-10-26
      • 2016-06-16
      • 2018-07-12
      • 2013-02-03
      相关资源
      最近更新 更多