How to increase session lifetime in Symfony2?
2 answers
Here is my approach (derived from Drupal config):
- set the handler to
native_file
(I would use PDOSessionHanlder, but it doesn't seem to be very stable); - create a directory
seesions
in a folderapp
;
config.yml
file:
session:
handler_id: session.handler.native_file
cookie_domain: %cookie_domain%
name: SFSESSID
cookie_lifetime: 2000000 # change this if you want
save_path: "%kernel.root_dir%/sessions"
gc_divisor: 100
gc_maxlifetime: 200000 # change this if you want
gc_probability: 1
+3
source to share