【发布时间】:2020-09-15 22:46:24
【问题描述】:
我正在尝试将 php 与 firebase
一起使用安装包后“composer require kreait/firebase-php ^4.0”
并调整我的火力基地
它向我显示了那个错误:
致命错误:未捕获的 GuzzleHttp\Exception\ConnectException:cURL 错误 35:OpenSSL SSL_connect:SSL_ERROR_SYSCALL 连接到 C:\xampp\htdocs\dashboard\webservice\php_firebase 中的 ff64t.firebaseio.com:443(请参阅 https://curl.haxx.se/libcurl/c/libcurl-errors.html) \vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:200 堆栈跟踪:#0 C:\xampp\htdocs\dashboard\webservice\php_firebase\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(155) : GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 C:\xampp\htdocs\dashboard\webservice\php_firebase\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php( 105):GuzzleHttp\Handler\CurlFactory::finishError(对象(GuzzleHttp\Handler\CurlHandler),对象(GuzzleHttp\Handler\EasyHandle),对象(GuzzleHttp\Handler\CurlFactory))#2 C:\xampp\htdocs\dashboard\ webservice\php_firebase\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(Guz in C:\xampp\htdoc s\dashboard\webservice\php_firebase\vendor\kreait\firebase-php\src\Firebase\Exception\ApiException.php 在第 40 行
我的php代码就是这么简单:
<?php
require_once './vendor/autoload.php';
use Kreait\Firebase\Factory;
use Kreait\Firebase\ServiceAccount;
$serviceAccount = ServiceAccount::fromJsonFile(__DIR__.'/secret/clone-7ef2-642f.json');
$firebase = (new Factory)
->withServiceAccount($serviceAccount)
//->withDatabaseUri("https://ff64t.firebaseio.com")
->create();
$database = $firebase->getDatabase();
$ref = $database->getReference('users');
$res = $ref->getChild('1z7ni171Hwgq8fdnandRNjfxBfw2')->getChild('name')->getValue();
var_dump($res);
?>
所以任何人都遇到过类似的事情以及如何解决这个问题
我尝试了很多解决方案,但没有一个有效。
我尝试重新安装 curl 并将其设置为系统变量 我也尝试添加
curl_setopt($easy->handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
让 curl 处理 IPV4...它给了我一个新错误:
致命错误:未捕获的 GuzzleHttp\Exception\RequestException:cURL 错误 0:cURL 请求重试了 3 次,但未成功。失败的最可能原因是 cURL 无法回退请求的正文,随后的重试导致相同的错误。打开调试选项,看看出了什么问题。有关更多信息,请参阅https://bugs.php.net/bug.php?id=47204。 (参见https://curl.haxx.se/libcurl/c/libcurl-errors.html)在 C:\xampp\htdocs\dashboard\webservice\firebase_php\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:201 堆栈跟踪:#0 C:\xampp\htdocs\dashboard\webservice \firebase_php\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(537): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), 数组) #1 C:\xampp\htdocs\dashboard \webservice\firebase_php\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(152):GuzzleHttp\Handler\CurlFactory::retryFailedRewind(对象(GuzzleHttp\Handler\CurlHandler),对象(GuzzleHttp\Handler\EasyHandle),数组) #2 C:\xam 在 C:\xampp\htdocs\dashboard\webservice\firebase_php\vendor\kreait\firebase-php\src\Firebase\Exception\ApiException.php 在第 40 行
我还检查了 phpinfo 中的 curl 支持和 ssl
【问题讨论】:
-
嗨!如果您能告诉我们您已经尝试过的一些解决方案,那就太好了。
-
好的,我会在帖子中添加它们
-
firebase-php.readthedocs.io/en/5.3.0/… - 另外,如果您至少使用 PHP 7.2,您应该迁移到 SDK 的 5.x 版????
-
我尝试了最新的SDK版本,但它不起作用