Reputation: 575
I am running Apache 2.2 with the latest build of PHP and mysql.
In my PHP.ini file, I can see the session timeout is set to 0, meaning the session stays live until the browser closes.
I have noticed however, that sometimes when coming in in the morning, and leaving the browser open and logged in overnight, the session seems to have expired.
Are there any other configuration settings that would be causing the session to expire? I just want to play around with the values and see what kind of time works best for my site.
Many thanks
Eds
Upvotes: 4
Views: 7455
Reputation: 2750
You can try:
https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
you can put this in your PHP file, second parameter is number of seconds after which data will be seen as 'garbage' and potentially cleaned up. :
ini_set('session.gc_maxlifetime', 30*60);
Hope this help!
Edit:
yes, i should mention that, thanks for pointing out.
As suggested by Willem
"call to that function has to be made before the session_start(); – Willem "
Example:
<?php
ini_set('session.gc_maxlifetime', 30*60);
session_start();
?>
Upvotes: 4