我已经实现PdoSessionHandler
以便在我的MySQL数据库as described in the docs中保存会话:
# app/config/config.yml
framework:
session:
handler_id: session.handler.pdo
# app/config/services.yml
services:
session.handler.pdo:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
public: false
arguments:
- "mysql:host=%database_host%;dbname=%database_name%"
- { db_table: _sessions, db_username: %database_user%, db_password: %database_password% }
这 - 一般情况下 - 工作正常(会话在db中保留),但我不断收到此错误:
request.CRITICAL: Uncaught PHP Exception
Symfony\Component\Debug\Exception\FatalErrorException: "Error: Call to a member function
prepare() on a non-object" at /srv/www/code/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
line 331 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0):
Error: Call to a member function prepare() on a non-object at /srv/www/code/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php:331)"} []
这是一个错误还是我的实施有问题?