Blue Horn

Symfony Framework

How to make Symfony session to never timeout

March 26, 2010 by Sid in Symfony Framework with 4 Comments

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:

    class: myUser
      # 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);

  // ...


  1. jb HerenJanuary 12, 2011 at 8:06 am

    Hello & Thank you very much, it also works with Symfony 1.4.

  2. 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 :

  3. 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.

  4. NeoSeptember 26, 2011 at 10:55 pm

    i tried it out – but seems it doesnt really work (maybe its caused by the apostrophe plugin).

Leave a reply

Your email address will not be published. Required fields are marked *


three + eleven =

My Projects
Restaurant Websites