[英]How can I increase session lifetime in Symfony2?
I have set the gc_maxlifetime in my config.yml file to 300. But its not working. 我已将config.yml文件中的gc_maxlifetime设置为300.但它不起作用。 Symfony2 still takes the value set in php.ini Symfony2仍然采用php.ini中设置的值
Symfony version is 2.4.4 Symfony版本是2.4.4
Here is my approach (gotten from Drupal configuration): 这是我的方法(从Drupal配置获得):
native_file
(i'd use PDOSessionHanlder, but seems it's not very stable); 将处理程序设置为native_file
(我使用PDOSessionHanlder,但似乎它不是很稳定); seesions
directory under app
folder; 在app
文件夹下创建一个seesions
目录; config.yml
file: config.yml
文件:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.