关于PHP cURL:SSL certificate error: unable to get local issuer certificate 问题
Window下PHP调用curl接口访问https网址时报错:
<blockquote>
SSL certificate error: unable to get local issuer certificate
</blockquote>
尝试关闭SSL_VERIFY验证,也可以解决问题,但是强烈不建议用该方法:
<blockquote>
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 0);
</blockquote>
最好的解决办法是添加certificate认证文件并修改PHP.ini配置
认证文件下载地址:https://github.com/bagder/ca-bundle/blob/e9175fec5d0c4d42de24ed6d84a06d504d5e5a09/ca-bundle.crt| 4ab91755879351f7528cd983dc88cd8811 |
php.ini 修改如下:
<blockquote>
curl.cainfo="C:/wamp/ca-bundle.crt"
openssl.cafile="C:/wamp/ca-bundle.crt"
</blockquote>
问题彻底解决