Thursday, March 30, 2017

Why is PHP ignore session.gc_maxlifetime?

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.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...