0
votes

I'm trying to migrate my App to Google App Engine php7.2. The Main problem is, that sessions are stored in Memcache. But I need more consistent sessions.

I've found a nice Repo that should solve the Problem https://github.com/tomwalder/php-gds-session But it throws an error after installation and inclusion.

Error: Class 'google\appengine\datastore\v4\LookupRequest' not found at GDS\Gateway\ProtoBuf->fetchByKeyPart (/srv/vendor/tomwalder/php-gds/src/GDS/Gateway/ProtoBuf.php:179) at GDS\Gateway->fetchByNames (/srv/vendor/tomwalder/php-gds/src/GDS/Gateway.php:194) at GDS\Gateway->fetchByName (/srv/vendor/tomwalder/php-gds/src/GDS/Gateway.php:122) at GDS\Store->fetchByName (/srv/vendor/tomwalder/php-gds/src/GDS/Store.php:184) at GDS\Session\Handler->read (/srv/vendor/tomwalder/php-gds-session/src/GDS/Session/Handler.php:176) at session_start ([internal function]) at GDS\Session\Handler::start (/srv/vendor/tomwalder/php-gds-session/src/GDS/Session/Handler.php:105) at {main} (/srv/bootstrap.php:12)

Can anybody help?

my 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"
  }

on top of bootstrap.php

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

2 Answers

0
votes

You could try changing the php-gds-session code from use GDS\Gateway\ProtoBuf; to use GDS\Gateway\RESTv1; and new Store($this->createSchema(), new ProtoBuf()); to new Store($this->createSchema(), new RESTv1());

0
votes

I’m the author of PHP-GDS. the reason it fails is that the new PHP 7.x runtimes do not have the same type of ProtoBuf support.

The REST alternative should work.

I’ll take a look at the library and see if I can provide a version that supports the REST gateway.