cURL错误60:SSL证书问题:自签名证书[已关闭]

cbjzeqam  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(115)

已关闭,此问题需要details or clarity。它目前不接受回答。
**想改善这个问题吗?**通过editing this post添加详细信息并澄清问题。

2天前关闭。
Improve this question
我没有复制最新的cacert.pem到文件夹curl.cainfo=“C:\xampp\php\extras\ssl\cacert.pem”,但仍然有错误“curl:(60)SSL证书问题'在我的localhost。

lsmepo6l

lsmepo6l1#

在你的php.ini也更新这个参数与相同的路径pem文件openssl.cafile="C:\xampp\php\extras\ssl\cacert.pem",比重新启动wamp.
你也可以把pem路径放在php代码中:

// For CURL
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__)."/path-to-file/cacert.pem");    

// For Guzzle
use GuzzleHttp\Client;
$this->client = new Client([
    'verify' => '/path/to/where/you/saved/your.pem',
]);

此解决方法很危险,不建议用于生产环境,但可以用于本地主机环境:

// For CURL
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);    
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

// For Guzzle
use GuzzleHttp\Client;
$this->client = new Client([
    'verify' => false,
]);

相关问题