1

I have a symfony2 project with a page to write the report of a meeting. It means the user can stay on this page and type for 2 hours without loading any new page. So when the user sends the form, his session has expired and he is sent to the login page. And he loses everything he typed.

I've already seen this post "symfony2 session lifetime" so here is my config.yml :

framework:
    session:
        handler_id:  ~
        cookie_lifetime: 86400
        gc_maxlifetime: 108000

So a 24 hours cookie lifetime and a 30 hour garbage collector... Still, I tried staying 1 hour on the page and I am disconnected...

Any idea where to look at ? Thanks !

Community
  • 1
  • 1
Nico Cnd
  • 59
  • 1
  • 10

2 Answers2

1

So, it looks like changing symfony's config.yml doesn't work. But after modifying the gc_maxlifetime to 108000 in my php.ini it works, I am not disconnected after some idle time.

I guess this might be linked to the handler_id: ~ (which is default), but I don't really know why... Anyway, works this way :)

Nico Cnd
  • 59
  • 1
  • 10
  • Did you keep the handler_id: ~ in your sym2 config while trying the modified settings? That might explain why your attempts to change it through sym2 config failed, by the handler_id you were specifically instructing sym2 to go look in the php.ini file for the config to use. – Matt Welander Sep 15 '17 at 05:22
0

Try these settings:

framework:
    session:
            cookie_lifetime: 60 #60 seconds
            gc_maxlifetime: 50 #50 seconds - only needed for testing. Dont use this in a production environment
            gc_probability: 1 #only needed for testing. Dont use this in a production environment
            gc_divisor: 1 #only needed for testing. Dont use this in a production environment

You can see them over here: https://codedump.io/share/9eVPS5otSIuk

Reformat Code
  • 307
  • 1
  • 3
  • No matter which values I give in symfony's config, they were ignored, but changing php.ini config worked – Nico Cnd Sep 26 '15 at 20:26