Symfony Framework
How to make Symfony session to never timeout
This is for Symfony 1.2 and sfGuardPlugin, but may be relevant for newer versions (1.3, 1.4, etc).
Setting timeout to false in factories.yml should’ve worked, e.g. like this:
all:
user:
class: myUser
param:
# this should have worked, but did not
timeout: false
But it didn’t work because I think ‘false’ did not get parsed as literal false.
Anyway, my hackish workaround is to add the following inside myUser.class.php:
class myUser extends sfGuardSecurityUser
{
public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array())
{
// disable timeout
$options['timeout'] = false;
parent::initialize($dispatcher, $storage, $options);
}
// ...
}
jb HerenJanuary 12, 2011 at 8:06 am
Hello & Thank you very much, it also works with Symfony 1.4.
jb HerenJanuary 13, 2011 at 9:30 am
anyway, I also had to change the php.ini value ‘session.gc_maxlifetime’ to 86400, as noticed in following posts : https://groups.google.com/group/symfony-fr/browse_thread/thread/ff3809d1cb655ff4?hl=fr
SidJanuary 13, 2011 at 9:42 amAuthor
Hi jb Heren,
Thanks for the info, it might come handy. Although, I don’t think I needed to change the php.ini to make it work.
NeoSeptember 26, 2011 at 10:55 pm
Hi,
i tried it out – but seems it doesnt really work (maybe its caused by the apostrophe plugin).