本地Windows环境, phpstudy 集成 php7 后,出现错误提示:cURL error 60: SSL certificate problem: unable to get local issuer certificate
查询问题:SSL CA证书配置缺失导致。
1、从CURL 官网下载CA 证书(cacert.pem)
可 选择下载:https://curl.haxx.se/docs/caextract.html
或 直接下载:https://curl.haxx.se/ca/cacert.pem
2、找到 phpstudy 安装路径,对应php版本包
例 安装路径下 php包:F:\phpstudy_pro\Extensions\php\php7.3.4nts\
将下载的cacert.pem文件,放入 \extras\ssl\ 文件夹下
3、修改配置 php.ini 文件
启用openssl, curl扩展
extension=curl
extension=openssl
配置CA 证书存放位置
[curl] ; A default value for the CURLOPT_CAINFO option. This is required to be an ; absolute path. curl.cainfo = "F:\phpstudy_pro\Extensions\php\php7.3.4nts\extras\ssl\cacert.pem" [openssl] ; The location of a Certificate Authority (CA) file on the local filesystem ; to use when verifying the identity of SSL/TLS peers. Most users should ; not specify a value for this directive as PHP will attempt to use the ; OS-managed cert stores in its absence. If specified, this value may still ; be overridden on a per-stream basis via the "cafile" SSL stream context ; option. openssl.cafile="F:\phpstudy_pro\Extensions\php\php7.3.4nts\extras\ssl\cacert.pem" ; If openssl.cafile is not specified or if the CA file is not found, the ; directory pointed to by openssl.capath is searched for a suitable ; certificate. This value must be a correctly hashed certificate directory. ; Most users should not specify a value for this directive as PHP will ; attempt to use the OS-managed cert stores in its absence. If specified, ; this value may still be overridden on a per-stream basis via the "capath" ; SSL stream context option. openssl.capath="F:\phpstudy_pro\Extensions\php\php7.3.4nts\extras\ssl"
PHP:cURL error 60: SSL certificate problem: unable to get local issuer certificate