18

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 2

29

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
Sign up to request clarification or add additional context in comments.

4 Comments

In case anyone else is wondering, you can find this documented here. It's also worth pointing out that one of the things this will affect is login expiry time.
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).
How to achieve this in Symfony >= 2.1.0 when user is using PDOSession ?
@Nis That looks like something to open a separate question for :-)
9

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

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!
This is all you need - symfony manages its sessions independently to the settings in php.ini.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.