We have a WAMP based server set up. php.ini
is set up with the following:
session.gc_maxlifetime = 60*60*12
session.save_path = "d:/wamp/tmp"
The problem we are facing is that session files inside the tmp
folder are being sporadically deleted and we can't tell why. Sessions will last anything from about 10 minutes to 40 minutes, when they should be lasting 12 hours.
This is a virtual host environment, but none of the code we use in these sites overrides this setting (with ini_set
, apache config PHP values or otherwise) so we can't see why they are being deleted. There are also no scheduled tasks deleting the files.
Is there a way to successfully figure out why gc_maxlifetime is being ignored? For the record, I changed one of our sites to use session_save_path('D:/wamp/tmptmp');
temporarily just to double check it was the garbage collection, and session files remain in there untouched - though admittedly this doesn't give really many more clues.
The configuration of session.gc_maxlifetime will determine how long before data is determined to be garbage. After that time, the session data may be deleted when "garbage collection" occurs. But that doesn't prevent the possibility of your session vars being deleted for some other reason.
Check Gumbo's answer here where he/she says "The best solution is to implement a session timeout on your own".
Faced the same problem when trying to cluster a certain project.
I discovered that the problem was caused by:
Try to delete it from your code or set the argument to false.