News Archive
PhpRiot Newsletter
Your Email Address:

More information Symfony: Session Login Timeout

Note: This article was originally published at PHPDeveloper on 7 July 2010.

On the blog there's a new post from Adam Pullen showing how to solve a common issue with user logins and timeouts in Symfony applications (especially those using something like sfGuard).

Symfony uses the PHP session management sub-system to store tempoary user specific data. When using the sfDoctrineGuardPlugin, or any other application guard, the timeout and lastRequest data are stored. [...] Since PHP has no clue of Symfony it will happily delete all session files that are older than the gc_maxlifetime value. This causes Symfony to logout the user. The user then has to login again. For all "day long apps" that are only used periodically (like time tracking software) this can cause some greif for the user.

His solution is to change the gc_maxlifetime setting in your php.ini file (or just the ini settings) to something higher than what Symfony will use. This can be done directly in your application too by defining the ini value on the fly in your factories.yml config file.