【问题标题】:php-gds-session Class LookupRequest not found找不到 php-gds-session 类 LookupRequest
【发布时间】:2019-06-17 08:16:50
【问题描述】:

我正在尝试将我的应用程序迁移到 Google App Engine php7.2。主要问题是,会话存储在 Memcache 中。但我需要更一致的会话。

我找到了一个很好的 Repo,它应该可以解决问题 https://github.com/tomwalder/php-gds-session 但它在安装和包含后会引发错误。

错误:找不到类“google\appengine\datastore\v4\LookupRequest” 在 GDS\Gateway\ProtoBuf->fetchByKeyPart (/srv/vendor/tomwalder/php-gds/src/GDS/Gateway/ProtoBuf.php:179) 在 GDS\Gateway->fetchByNames (/srv/vendor/tomwalder/php-gds/src/GDS/Gateway.php:194) 在 GDS\Gateway->fetchByName (/srv/vendor/tomwalder/php-gds/src/GDS/Gateway.php:122) 在 GDS\Store->fetchByName (/srv/vendor/tomwalder/php-gds/src/GDS/Store.php:184) 在 GDS\Session\Handler-> 读取 (/srv/vendor/tomwalder/php-gds-session/src/GDS/Session/Handler.php:176) 在 session_start ([内部函数]) 在 GDS\Session\Handler::start (/srv/vendor/tomwalder/php-gds-session/src/GDS/Session/Handler.php:105) 在 {main} (/srv/bootstrap.php:12)

有人可以帮忙吗?

我的 composer.json:

"require": {
    "php": ">=5.3.0",
    "google/cloud-logging": "^1.16",
    "google/cloud-error-reporting": "^0.14.4",
    "google/cloud-storage": "^1.12",
    "google/cloud-datastore": "^1.9",
    "monolog/monolog": "^1.24",
    "league/flysystem-sftp": "^1.0",
    "aws/aws-sdk-php": "^3.94",
    "vlucas/phpdotenv": "^3.3",
    "php-http/guzzle6-adapter": "^1.1",
    "bugsnag/bugsnag": "^3.16",
    "mailgun/mailgun-php": "~2.0",
    "paragonie/random_compat": "<9.99",
    "tomwalder/php-gds-session": "v1.0.0",
    "google/apiclient": "^2.2"
  }

在 bootstrap.php 之上

// Fix for finding Application-ID on GAE
if(!isset($_SERVER['APPLICATION_ID'])){
   $_SERVER['APPLICATION_ID'] = $_SERVER['GAE_APPLICATION'];
}
GDS\Session\Handler::start();

【问题讨论】:

    标签: php google-app-engine google-cloud-datastore


    【解决方案1】:

    您可以尝试将 php-gds-session 代码从 use GDS\Gateway\ProtoBuf; 更改为 use GDS\Gateway\RESTv1;和new Store($this-&gt;createSchema(), new ProtoBuf());new Store($this-&gt;createSchema(), new RESTv1());

    【讨论】:

    • thx @jim-morrison,但我认为在依赖包中更改私有方法不是一个好主意
    【解决方案2】:

    我是 PHP-GDS 的作者。失败的原因是新的 PHP 7.x 运行时没有相同类型的 ProtoBuf 支持。

    REST 替代方案应该可以工作。

    我会看一下库,看看是否可以提供支持 REST 网关的版本。

    【讨论】:

      猜你喜欢
      • 2017-08-10
      • 1970-01-01
      • 1970-01-01
      • 2012-07-20
      • 1970-01-01
      • 1970-01-01
      • 2014-02-25
      • 2017-05-24
      • 2015-04-04
      相关资源
      最近更新 更多