'How can I prevent autologout of user in Symfony 4?
When the user uses my symfony application, then after a couple of minutes the user is automatically logged out, while he is working with the application. To prevent that I changed in
config/packages/framework.yaml
framework:
session:
cookie_lifetime: 86400
gc_maxlifetime: 1800
This means the cookie lifetime is set to 24 hours. So I expect the user will only be logged out when he closes the browser. But in reality he is still automatically logged out after half in hour or so. What other options can I try?
Solution 1:[1]
Did you try to unset gc_maxlifetime ? It seem that PHP clear the session after this time. Moreover it's 30 minutes lifetime like your logged out problem.
framework:
session:
cookie_lifetime: 86400
You should definitively don't set gc_probability
to null otherwise PHP won't ever clean your "dead" session and your server will be lack of disk space after a time.
Also it can be worth it to have a look to your php.ini
configuration values because PHP will take them if they aren't specifid in Symfony configuration.
In other words Symfony override your PHP configuration if you specify somes configurations (there is a list of them )
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |