Ani*_*ena 4 php laravel firebase
我正在使用 Firebase php SDK链接并在 Windows 10 上的 XAMMP 服务器上使用 laravel 最新版本,但是当我尝试使用上面的 php SDK 使用 Firebase API 时,我收到此错误。我手动下载 .pem 证书但仍然无法正常工作
错误
Kreait \ Firebase \ Exception \ ApiException
cURL error 77: error setting certificate verify locations: CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Previous exceptions
cURL error 77: error setting certificate verify locations: CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt CApath: none (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) (0)
Run Code Online (Sandbox Code Playgroud)
在您的情况下,只需执行此操作
打开你的 php.ini 文件并更新它
;openssl.cafile=
Run Code Online (Sandbox Code Playgroud)
和
openssl.cafile="C:\xampp\apache\bin\curl-ca-bundle.crt"
Run Code Online (Sandbox Code Playgroud)
对于可能面临此错误的其他人,请按照以下步骤操作:
这与您的 cURL 认证有关。采取以下步骤:
前往http://curl.haxx.se/ca/cacert.pem. 此链接为您提供(下载)最新的 cacert.pem 文件。
您目前正在这样你就知道在您的计算机上PHP的多个安装的情况下使用的确切PHP应用在终端上使用此命令,php -i | grep 'Configuration File'。这会显示您正在运行的当前应用程序的 php.ini 文件的确切位置。例如,我的是C:\php-7.4.11\php.ini。请注意此位置,因为我们将很快使用它。
进入这个位置C:\php-7.4.11即。在我的例子中包含 php.ini 文件的文件夹,打开“extras”,打开“ssl”(为了清楚起见,我的看起来像这样C:\php-7.4.11\extras\ssl)。在此文件夹中,粘贴上面步骤 1 中新下载的 cacert.pem 文件。
右键单击 cacert.pem 文件并从“属性”中取消阻止它,因为它可能会抱怨来自另一台计算机。仍然在这个“属性”部分弹出窗口中,从“安全”部分复制新的文件位置链接(我的是C:\php-7.4.11\extras\ssl\cacert.pem确保复制你的)。您也可以从文件浏览器标题中复制它。
转到此位置C:\php-7.4.11\php.ini(这是我的 php.ini 位置。转到您的位置)并更新 php.ini 文件中的以下 2 个字段。
;curl.cainfo =
;openssl.cafile=
和
curl.cainfo ="C:\php-7.4.11\extras\ssl\cacert.pem"
openssl.cafile="C:\php-7.4.11\extras\ssl\cacert.pem"
Run Code Online (Sandbox Code Playgroud)
注意:如果curl.cainfo未更新,您会收到 cURL 60 错误。如果openssl.cafile未更新,则 cURL 77 。
另外,不要忘记取消对;beforecurl.cainfo和openssl.cafile 的注释。
希望这可以帮助某人。
在我使用 MAMP PRO 的情况下,我遇到了这个错误:
CURL error: error setting certificate verify locations:
CAfile: /Applications/MAMP/Library/OpenSSL/cert.pem
CApath: none
Run Code Online (Sandbox Code Playgroud)
文件 /Applications/MAMP/Library/OpenSSL/cert.pem 是 /Applications/MAMP/Library/OpenSSL/certs/cacert.pem 的符号链接
该文件似乎在这里,但似乎已损坏或已过期。
我从这里下载了新的并替换了它。然后它又起作用了。
| 归档时间: |
|
| 查看次数: |
4582 次 |
| 最近记录: |