One of the main features to configure while developing a website that has access for users (in frontend, backend or both) is to set the session timeout. Its value defines time (measured in seconds) after which user session data will become out of date, if that user has performed no activity. For example, the default session expire time in symfony is 1800, which is 30 minutes (60*30), if a user is logged in and he won't do anything for at least 1800 seconds, he'll be automatically logged out.
solution
There are several blog posts in the internet describing where to change this value, but they refer only to symfony 1.0 (which is really old... and solutions described there do not apply to sf 1.3/1.4). So, the file is apps/APP_NAME/config/factories.yml. You need to add the following lines:
all: user: class: myUser param: timeout: 7200
where 7200 can be replaced with whatever unsigned integer value you want. Take a look at the main factories configuration file in symfony core: lib/vendor/symfony/lib/config/config/factories.yml. You'll find the default/user section there which holds all interesting stuff.
nice and helpful
ReplyDeleteThanks. Simple to the point and effective.
ReplyDeleteWell,
ReplyDeleteyou can also use :
all:
user:
param:
timeout: false
But be careful, it apparently doesn't work in sf1.0.
thank you
ReplyDeleteThanking you very much.
ReplyDeleteThis symfony factories.yml configuration reference explains everything about user configuration:
ReplyDeletehttp://www.symfonyreference.com/factories-yml
Thanks!
ReplyDeleteAnother Thank you !!!
ReplyDeleteUseful
ReplyDeletesolution for my project
Thanks!!!! :D
ReplyDeleteIf it's not working, you have to check your PHP server configuration which also has to be set properly. Display phpinfo() and look at session.gc_maxlifetime
ReplyDeleteThis could help also if you are having issues with the cookie logged time, in config\app.yml:
ReplyDelete# default values
#all:
all:
a:
# If true, there will be a language switcher next to the login/logout button
i18n_switch: true
i18n_languages: [es, en]
#http://www.symfony-project.org/plugins/sfGuardPlugin
#http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin
sf_guard_plugin:
remember_cookie_name: dbvui_cookie
remember_key_expiration_age: 2592000 # 30 days in seconds
Yes it help me!
ReplyDeleteit works for me. really thanks!!
ReplyDeleteThanks for this quicktip!
ReplyDelete