PHP Nette - sessions problem - i must very often login to app after inactivity
Hi,
I am logged out of my php nette project very often after about 20 minutes of inactivity, although I have set in config.neon this:
On another project with the same session expiration setting, but on another server, this automatic logout does not happen. Anyone know what it is? Thanks
Hi,
you will certainly need to change the session configuration in php.ini, usually this is set to:
For example, if you use /etc/php/7.2/fpm/php.ini, php-fpm, nginx, and you want session.gc_maxlifetime to be 56000, the procedure would be:
I am logged out of my php nette project very often after about 20 minutes of inactivity, although I have set in config.neon this:
session:
expiration: 14 days
autoStart: true
On another project with the same session expiration setting, but on another server, this automatic logout does not happen. Anyone know what it is? Thanks
REPLY
Hi,
you will certainly need to change the session configuration in php.ini, usually this is set to:
session.gc_maxlifetime = 1440
.For example, if you use /etc/php/7.2/fpm/php.ini, php-fpm, nginx, and you want session.gc_maxlifetime to be 56000, the procedure would be:
vim /etc/php/7.2/fpm/php.ini
; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
; http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 56000
systemctl restart php7.2-fpm
systemctl reload nginx