【已解決】windows下開(kāi)發(fā)環(huán)境 PHP/Laravel cURL 報(bào)錯(cuò):cURL error 77: error setting certificate verify locations:x...

錯(cuò)誤信息表示 php.ini中配置的CA證書(shū)不到

第一步:下載最新證書(shū)

下載最新CA證書(shū)

第二步:將下載的cacert.pem重命名為:curl-ca-bundle.crt

如果是windows開(kāi)發(fā)環(huán)境,必須將名稱重命名為: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證書(shū)路徑

[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證書(shū)路徑

; 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證書(shū)所在目錄路徑

第四步:重啟服務(wù)即可

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容