PHP Expiration

I have a session that is destroyed after 30 minutes of inactivity or destroyed after 23.4 hours.

The problem that I have, regardless of activity, the session is destroyed after 30 minutes. Therefore, if the user is constantly working for 23.4 hours, the session must be maintained for 23.4 hours and then destroyed, forcing the user to log back in, but the session is destroyed after 30 minutes, even if the user is constantly active for these 30 minutes.

Since the garbage collector looks at the changed time, not the access time, the session is updated with time(), so the changed time is updated when the user does something on the site.

Here are the php.ini session settings:

Directive                   Local Value     Master Value
session.cache_expire        30              30
session.cookie_lifetime     1800            1800
session.gc_divisor          1000            1000
session.gc_maxlifetime      84400           84400
session.gc_probability      1               1
session.save_handler        files           files

If you need any other ini session settings let me know.

Any help with this would be greatly appreciated.

thank

+3
source share
2 answers

session.cookie_lifetime is set to 30 minutes, so the cookie will expire after 30 minutes, it will not be sent to the server at the next request (after 30 minutes), and php will issue another session since he / she (php) did not receive it in the request.

+3
source
  • Do not touch the default settings for sessions. Leave the defaults.

  • Check the session time of the session using the session itself.

0
source

Source: https://habr.com/ru/post/1788460/


All Articles