How to Setup sfPDOSessionStorage
Setting up sfPDOSessionStorage is a fairly simple matter to make sure that sessions exist on a setup with multiple web-heads.
Add the following code to your app/
all:
storage:
class: sfPDOSessionStorage
param:
db_table: session # table storing the sessions
database: propel # database connection to use
# Optional parameters
db_id_col: sess_id # column storing the session id
db_data_col: sess_data # column storing the session data
db_time_col: sess_time # column storing the session timestamp
Make sure your remove all unnecessary references to setting a different storage mechanism
Now add the following YAML to your config/schema.yml file. This creates the table structure.
# Session
session:
_attributes: { phpName: Session }
sess_id: { type: varchar, size: 64, required: true, primaryKey: true }
sess_data: { type: longvarchar }
sess_time: { type: INTEGER, size: '11'}
_indexes: { SESSIONTIME: [sess_time] }
Now, generate the SQL for your current model just for giggles. I try to keep the generated SQL as up to date as possible.
./symfony cc ./symfony propel:build-sql
If you need to make this change to an existing dataaset, here is the raw SQL to create the table:
CREATE TABLE `sessions`
(
`sess_id` VARCHAR(64) NOT NULL,
`sess_data` TEXT,
`sess_time` INTEGER(11),
PRIMARY KEY (`sess_id`),
KEY `SESSIONTIME`(`sess_time`)
)Type=InnoDB;