How to set PHP Session Timeout (Low Code Corner #10)

Опубликовано: 12 Октябрь 2024
на канале: DaDaBIK No-code Low-code Platform
2,246
8

In this video, we discuss how to change the session timeout in PHP.

As explained in the video, you have to work on these parameters:
session.gc_maxlifetime
session.gc_probability
session.gc_divisor

either by editing php.ini or by setting the parameters using the ini_set() PHP function.

As anticipated at the end of the video, there are other two aspects that might impact on the duration of the session:

1) Duration of the session cookie (session.cookie_lifetime, see https://www.php.net/manual/en/session... by default it's 0, which means "until the browser is closed". If the cookie expires (or it is deleted) before the session data expires, the current session data will not be valid anymore for the user.

2) If, on your sever, there are different scripts using different values of session.gc_maxlifetime and they share the same folder for storing the session data, than the minimum value of session.gc_maxlifetime found will be used. To avoid these issue, you can use session.save_path (see https://www.php.net/manual/en/session....

DaDaBIK is a low-code/no-code platform for Web database application Development.

Try the on-line demo: https://dadabik.com/demo

Buy a license: https://dadabik.com/download

Credits:
Music: "Future City Funk" by bad Snacks