Windows 下關於 CURL SSL 證書的放置說明

首先,我們從這個地址摸到 cacert.pem 文件:https://curl.haxx.se/docs/caextract.html

在 PHP 的配置文件 php.ini 中我們可以搜索 curl.cainfo 並通過填寫正確的路徑指向使得 ComposerCURL 能夠正常請求

不過還有一個全局的更合理的方式,通過該鏈接:https://curl.haxx.se/docs/sslcerts.html

在其中搜索 CURL_CA_BUNDLE 我們可以得知:

If you're using the curl command line tool on Windows, curl will search for a CA cert file named "curl-ca-bundle.crt" in these directories and in this order:

	1. application's directory
	2. current working directory
	3. Windows System directory (e.g. C:\windows\system32)
	4. Windows Directory (e.g. C:\windows)
	5. all directories along %PATH%

如果您在 Windows 中使用 curl 命令行工具,curl 將在以下目錄中按如下順序搜索名爲 curl-ca-bundle.crt 的 CA 證書文件:

	1. 應用程序目錄
	2. 當前執行目錄
	3. C:\Windows\System32
	4. C:\Windows
	5. 環境變量 %PATH% 中的所有路徑

簡單來說,我們其實不用去設置一些相關參數,直接將 cacert.pem 文件重命名爲 curl-ca-bundle.crt 並扔到 C:\WindowsC:\Windows\System32 就行了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章