WAMP&Laravel:cURL error 60: SSL certificate problem: unable to get local issuer certificate

"message": "cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.weixin.qq.com/sns/jscode2session?appid=wxf8b9dbefc889bcaf&secret=3ed00514cbe0a52c6d708a76ba318acd&js_code=0e3zkmFa1Xrd2I0e6lIa1PWwcv1zkmFO&grant_type=authorization_code",

CURLE_PEER_FAILED_VERIFICATION (60)

The remote server's SSL certificate or SSH fingerprint was deemed not OK. This error code has been unified with CURLE_SSL_CACERT since 7.62.0. Its previous value was 51.

1、进入以下链接下载pem证书

https://curl.se/docs/caextract.html

image-20240823235340543.png

2、执行下述命令,找到文件目录

php -i | findstr php.ini

image-20240823233346398.png

3、将下载的文件放到php.ini同级目录的./extras/ssl

image-20240823235455596.png

4、编辑php.ini,搜索curl.cainfo,以下形式,将文件路径添加,并把注释符号;去掉

image-20240823235722724.png

5、查看openssl扩展打开了吗?

php.ini搜索openssl,前边有;注释的话去掉

6、清除缓存

php artisan cache:clear

image-20240823234450819.png

7、测试还不行的话,那就直接从wamp里直接找到php.ini,如果你用wamp的话大概率和我是一样的问题,见下图

image-20240824002640015.png

因为我刚开始按照上边的步骤改完保存后,发现从wamp里打开的php.ini根本就没动,才发现改错文件了,在使用Apache的情况下,应该改phpForApache.ini文件。


本文由 fmujie 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

还不快抢沙发

添加新评论

召唤看板娘