问题
在请求第三方接口时,本地开发中由于本地没有安装curl证书,如果不关闭SSL 验证就会报SSL验证错误:
Could not verify SSL certificate. Please make sure that your network is not intercepting certificates. (Try going to https://checkout-test.*** in your browser.) If this problem persists;
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://***.com/
解决办法:
-
下载最新的 CA bundle 文件:
👉 https://curl.se/ca/cacert.pem 放到例如:
bash
C:\php\extras\ssl\cacert.pem
- 修改 php.ini(找到并取消注释 / 添加以下行):
php
[curl]
curl.cainfo = "C:\php\extras\ssl\cacert.pem"
[openssl]
openssl.cafile = "C:\php\extras\ssl\cacert.pem"
- 重启 Apache 或 PHP-FPM。