Symfony 3 WebSocketBundle PdoSessionHandler

时间:2017-02-18 09:52:17

标签: php websocket symfony phpwebsocket

这就是我设置WebSocketBundle的方式:

config.yml

gos_web_socket:
server:
    port: 8080
    host: localhost
client:
    firewall: main
    session_handler: session.handler.pdo
shared_config: true

那是我的 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_username: '%database_user%', db_password: '%database_password%' }

我可以使用 php bin / console gos:websocket:server 在控制台中成功启动服务器。但是,当我尝试从webbrowser连接到服务器时,终端会显示致命错误:

控制台

C:\xampp\htdocs>php bin/console gos:websocket:server
[2017-02-18 10:38:13] websocket.INFO: Starting web socket
[2017-02-18 10:38:13] websocket.INFO: Launching Ratchet on localhost:8080 PID: 26568
PHP Fatal error:  Call to a member function beginTransaction() on null in C:\xampp\htdocs\vendor\symfony\symfony\src\Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler.php on line 439

Fatal error: Call to a member function beginTransaction() on null in C:\xampp\htdocs\vendor\symfony\symfony\src\Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler.php on line 439
[2017-02-18 10:38:16] php.CRITICAL: Fatal Error: Call to a member function beginTransaction() on null {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Error: Call to a member function beginTransaction() on null at C:\\xampp\\htdocs\\vendor\\symfony\\symfony\\src\\Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler.php:439)"}


  [Symfony\Component\Debug\Exception\FatalErrorException]
  Error: Call to a member function beginTransaction() on null

我做错了什么?

0 个答案:

没有答案