我尝试将会话数据存储到postgresql数据库中。 我必须准确地说,使用默认会话存储我有任何问题。
所以我配置我的配置文件,如下所述: http://symfony.com/doc/current/cookbook/configuration/pdo_session_storage.html
session:
handler_id: session.handler.pdo
parameters:
pdo.db_options:
db_table: session
db_id_col: session_id
db_data_col: session_value
db_time_col: session_time
pdo:
class: PDO
arguments:
- "pgsql:dbname=%database_name%"
- %database_user%
- %database_password%
session.handler.pdo:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
arguments: [@pdo, %pdo.db_options%]
然后当我清除缓存时出现此错误:
[PDOException]
SQLSTATE [08006] [7]致命:认证同行?chou?e pour l'utilisateur
这是我用来创建表会话的脚本:
CREATE TABLE session
(
session_id character varying(255) NOT NULL,
session_value text NOT NULL,
session_time integer NOT NULL,
CONSTRAINT session_pkey PRIMARY KEY (session_id )
)
WITH (
OIDS=FALSE
);
ALTER TABLE session
OWNER TO myuser;
不能有人帮我吗?
答案 0 :(得分:0)
PDO dsn缺少主机:
session:
handler_id: session.handler.pdo
parameters:
pdo.db_options:
db_table: session
db_id_col: session_id
db_data_col: session_value
db_time_col: session_time
pdo:
class: PDO
arguments:
- "pgsql:host=%database_host%;dbname=%database_name%"
- %database_user%
- %database_password%
session.handler.pdo:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
arguments: [@pdo, %pdo.db_options%]
如果没有主机值,我会遇到与您相同的错误:
[PDOException]
SQLSTATE[08006] [7] FATAL: Peer authentication failed for user "postgres"
希望这有帮助