截至星期六,我的PayPal IPN触发时,突然出现“ cURL错误:[60] SSL证书问题:无法获取本地发行者证书”。我已经有几个月没有更改网站上的任何代码了,据我所知,我没有运行任何会造成干扰的自动升级。
我已经阅读了数十篇Stack帖子,其中没有任何内容。我已将.crt移至其他目录并更新了cURLOPT_CAINFO。重新启动httpd和cpanel。列出了php.ini中的证书。 (它没有在开始之前出现,所以我就这样了。)下载并安装了.pem文件,我认为这与这无关。没有一个起作用。
PayPal已验证正在发送IPN消息,并且PayPal沙箱成功验证了握手。网站上有常规的SSL,并且运行正常。
服务器是GoDaddy VPS,带有Apache 2.4.41的CentOs Linux 7。
我不愿意关闭VERIFYPEER或以不安全的设置进行操作。
我的代码:
protected function curlPost($encoded_data)
{
$uri = 'https://'.$this->getPaypalHost().'/cgi-bin/webscr';
$this->post_uri = $uri;
$ch = curl_init();
if ($this->verify_ssl) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, '/home/shopusa/public_html/app/Support/cert/api_cert_chain.crt');
}
curl_setopt($ch, CURLOPT_URL, $uri);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $this->follow_location);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
$this->response = curl_exec($ch);
$this->response_status = strval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
if ($this->response === false || $this->response_status == '0') {
$errno = curl_errno($ch);
$errstr = curl_error($ch);
throw new Exception("cURL error: [$errno] $errstr");
}
return $this->response;
}
根据终端,文件在这里,由网络用户拥有:
[root@ip-###-###-###-## cert]# cd /home/shopusa/public_html/app/Support/cert/
[root@ip-###-###-###-## cert]# ls
api_cert_chain.crt _notes
所有权限分别是755 /目录和644 /文件。
有什么东西跳出来吗?我花了大约八个小时来解决这个问题,但对于如何再次触发IPN侦听器,我没有任何想法。
用更新证书颁发机构捆绑包替换api_cert_chain.crt
,该证书捆绑包能够验证PayPal服务器当前的加密安全证书的颁发者。
也许来自https://curl.haxx.se/docs/caextract.html(如有必要,可将pem转换为crt,尽管我认为不是)