Google Php Oauth Login Error No system CA bundle could be found
我完全按照示例进行操作,但出现错误$client->authenticate($_GET['Code']);正在返回代码值,但不会进行身份验证.错误是
I am exactly following the example but get an error on $client->authenticate($_GET['Code']); The code value is being returned but will not authenticate. The error is
致命错误:未捕获的异常RuntimeException"和消息在任何公共系统位置都找不到系统 CA 捆绑包.低于 5.6 的 PHP 版本未正确配置为默认使用系统的 CA 包.为了验证对等证书,您需要将磁盘上的路径提供给验证"请求选项的证书包:http://docs.guzzlephp.org/en/latest/clients.html#verify.如果你不需要特定的证书包,Mozilla 提供了一个常用的 CA 包,可以在这里下载(由 cURL 的维护者提供):https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt.一旦你在磁盘上有一个可用的 CA 包,你可以设置 'openssl.cafile' PHP ini 设置指向文件的路径,允许你省略 'verify' 请求选项.有关详细信息,请参阅 http://curl.haxx.se/docs/sslcerts.html.在/base/data/home/apps/s~solomon-1/1.388711045841969234/google-api-php-client/vendor/guzzlehttp/ringphp/src/Client/Cli 在/base/data/home/apps/s~solomon-1/1.388711045841969234/google-api-php-client/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php 在第 51 行
Fatal error: Uncaught exception 'RuntimeException' with message ' No system CA bundle could be found in any of the the common system locations. PHP versions earlier than 5.6 are not properly configured to use the system's CA bundle by default. In order to verify peer certificates, you will need to supply the path on disk to a certificate bundle to the 'verify' request option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not need a specific certificate bundle, then Mozilla provides a commonly used CA bundle which can be downloaded here (provided by the maintainer of cURL): https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt. Once you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP ini setting to point to the path to the file, allowing you to omit the 'verify' request option. See http://curl.haxx.se/docs/sslcerts.html for more information.' in /base/data/home/apps/s~solomon-1/1.388711045841969234/google-api-php-client/vendor/guzzlehttp/ringphp/src/Client/Cli in /base/data/home/apps/s~solomon-1/1.388711045841969234/google-api-php-client/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 51
??
推荐答案
浏览 Google 和 Guzzle 的 代码,您可能需要通过执行类似在您设置 Google 客户端时以及在您的 authenticate()
调用之前执行以下操作:
Looking through Google and Guzzle's code you might need to specify where the certificate bundle can be found by doing something like the following when you setup the Google Client and before your authenticate()
call:
$client->setHttpClient(new GuzzleHttpClient(['verify'=>'path oyourcert-bundle']));
这将覆盖默认行为并让您指定捆绑包的位置.
This will override the default behavior and let you specify where the bundle is.
您还可以通过将 verify
设置为 false
来测试这是正确的方向:
You could also test that this is the right direction by setting verify
to false
:
$client->setHttpClient(new GuzzleHttpClient(['verify'=>false]));
这基本上会告诉 curl 不要验证主机或对等方.
This will basically tell curl not to verify the host nor the peer.
相关文章