Do PHP sessions timeout by default - ie without any coding on my part would a user eventually be "logged out" after some time of inactivity?
1440 seconds is the default which is actually 24 minutes.
By default, the PHP session expired when you close the browser or after a specific time. That usually is 24 minutes, but it depends on your server configuration.
if you want to expire the session after 30 minutes of activity instead of after 30 minutes since start, you'll also need to use setcookie with an expire of time()+60*30 to keep the session cookie active.
By default, session variables last until the user closes the browser. So; Session variables hold information about one single user, and are available to all pages in one application. Tip: If you need a permanent storage, you may want to store the data in a database.
It depends on the server configuration or the relevant directives session.gc_maxlifetime in php.ini
.
Typically the default is 24 minutes (1440 seconds), but your webhost may have altered the default to something else.
You can change it in you php-configuration on your webserver. Search in php.ini
for
session.gc_maxlifetime()
The value is set in Seconds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With