【微信开发】cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

在做微信开发时候,请求为你接口报错:

【微信开发】cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

 

解决方案: 

 

1 下载cacert

https://curl.haxx.se/ca/cacert.pem

2 修改 php.ini , 并重启

curl.cainfo="真实路径/cacert.pem"

 

注意: 开启 php_curl   php_openssl 扩展,

如果是用php curl() 方法 的话。可以 清除ssl证书校验

<?php
// 创建curl资源
$ch = curl_init(); 
// 设置url
curl_setopt($ch, CURLOPT_URL, "https://www.test.com"); 
// 将Transfer作为字符串返回
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// 关闭SSL验证
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// 执行并输出
$output = curl_exec($ch); 
// 查看错误
$error = curl_error($ch);
echo $error;
// 释放curl资源
curl_close($ch);  

 

【微信开发】cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

上一篇:JS-DOM 综合练习-动态添加删除班级成绩表


下一篇:吐血记录微信小程序授权获取Unionid及linux下使用bouncycastle解密用户数据 遇到的坑