php中出现的cURL error 60: SSL certificate problem: unable to get local issuer certificate

在使用laravel的过程中,调用一个接口总是出错,dd一看是这个错误cURL error 60: SSL certificate problem: unable to get local issuer certificate,默认情况下cURL是不被信任任何CAS,出现CA的证书问题,在此记录一下解决步骤:

一、下载cacert.pem

进入官网,下载最新版(外网可能加载比较慢)
在这里插入图片描述

二、放入php文件下extras/ssl里面

在这里插入图片描述

三、配置php.ini

将curl.cainfo和openssl.cafile的路径配置成上面pem文件下载位置,注意将注释;去掉,否则不生效
在这里插入图片描述

四、如果开启了php服务,需要重启服务器才可以生效

猜你喜欢

转载自blog.csdn.net/skybulex/article/details/123566230