How to end a PHP session after 30 minutes of user inactivity?
Hello colleagues! I'm a beginner in PHP and I'm developing a site where users log in. I have a simple session system: after login, I save data in `$_SESSION`. But I noticed that the session does not end even if the user closes the browser and returns an hour later — they are still logged in. I need the session to automatically expire 30 minutes after the user's last action (not from the moment of login, but specifically after the last click or request).
I've read about the `session.gc_maxlifetime` and `session.cookie_lifetime` parameters, but they don't work as I expect. For example, I set:
```php
ini_set('session.gc_maxlifetime', 1800);
ini_set('session.cookie_lifetime', 1800);
session_start();
```
But this seems to only affect the lifetime of the session file on the server and the cookie in
No answers yet.
Log in to leave an answer