【已解决】windows下开发环境 PHP/Laravel cURL 报错:cURL error 77: error setting certificate verify locations:x...

错误信息表示 php.ini中配置的CA证书不到

第一步:下载最新证书

下载最新CA证书

第二步:将下载的cacert.pem重命名为:curl-ca-bundle.crt

如果是windows开发环境,必须将名称重命名为:curl-ca-bundle.crt

第三步:修改php.ini文件 配置 curl.cainfo、openssl.cafile、openssl.capath 如下:

# php.ini文件
......
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo ="G:\phpstudy_pro\Extensions\php\php7.1.9nts\extras\ssl\curl-ca-bundle.crt" # 替换为你的ca证书路径

[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="G:\phpstudy_pro\Extensions\php\php7.1.9nts\extras\ssl\curl-ca-bundle.crt" # 替换为你的ca证书路径

; 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="G:\phpstudy_pro\Extensions\php\php7.1.9nts\extras\ssl" # 替换为你的ca证书所在目录路径

第四步:重启服务即可

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容