找到你要的答案

Q:Curl err (60) SSL certificate: unable to get local issuer certificate

Q:卷曲的错误(60)SSL证书:无法获取本地发行者证书

I would like to connect to some API by SSL.

Already I have generated 5 files:

PROD.cert.pem
PROD.issuer.pem
PROD.chain.pem
PROD.csr
PROD.key

This is my php code:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,           $wsdl);
curl_setopt($ch, CURLOPT_SSLCERT,       getcwd() . '\PROD.cert.pem');
curl_setopt($ch, CURLOPT_SSLKEY, getcwd() . '\PROD.key');

$output = curl_exec($ch);

var_dump(curl_errno($ch));
var_dump(curl_error($ch));

So, as you can see I add two files: cert and key

When, I run this code I always got error:

SSL certificate problem: unable to get local issuer certificate

Do you know, what I do wrong? How can I resolve this error?

我想通过SSL连接到一些API。

我已经生成了5个文件:

PROD.cert.pem
PROD.issuer.pem
PROD.chain.pem
PROD.csr
PROD.key

这是我的PHP代码:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,           $wsdl);
curl_setopt($ch, CURLOPT_SSLCERT,       getcwd() . '\PROD.cert.pem');
curl_setopt($ch, CURLOPT_SSLKEY, getcwd() . '\PROD.key');

$output = curl_exec($ch);

var_dump(curl_errno($ch));
var_dump(curl_error($ch));

所以,你可以看到我添加了两个文件:证书和密钥

我运行这个代码时总是出错:

SSL certificate problem: unable to get local issuer certificate

你知道我做错了什么吗?我该如何解决这个错误?

answer1: 回答1:

Certificates are not be included in your webdir, you need to install them on your webserver. You can find a comprehensive guide here

证书不被包含在你的webdir,你需要安装到你的服务器。你可以在这里找到一个全面的指南

php  ssl  curl