I would like to know how to increase the session timeout in symfony. Is it enough to only adjust the symfony configuration settings or must I also configure anything in my php.ini file?
2 Answers
For Symfony 2.0.x
framework:
session:
lifetime: 43200 #time in seconds
For Symfony >= 2.1.0
framework:
session:
cookie_lifetime: 43200 #time in seconds
4 Comments
caligari
However, that parameter configures de lifetime for the cookie (not for the session indeed) resulting that sessions are closed after the specified time since creation (they are not renewed).
Nis
How to achieve this in Symfony >= 2.1.0 when user is using PDOSession ?
Potherca
@Nis That looks like something to open a separate question for :-)
for sf1.0:
Change the value in apps/appname/config/settings.yml:
all:
.settings:
timeout: 1800 #session lifetime value in seconds
for sf1.1+:
Add these lines to apps/appname/config/factories.yml:
user:
class: myUser
param:
timeout: 1800 #session lifetime value in seconds
2 Comments
Rui Gonçalves
Hi there! Thanks for the help! Is this configuration enough or some other change needs to be made on php.ini file? Thanks in advance, Best regards!
Raise
This is all you need - symfony manages its sessions independently to the settings in php.ini.