jacko310592 Posted September 3, 2010 Share Posted September 3, 2010 hey guys, i recently changed my session save directory to "/home/jacko/LocalHost/sess" using htaccess, but now ive noticed that sessions dont seem to be expiring, i still have sessions in the folder from testing my website yesterday. Was i incorrect in thinking that sessions are supposed to expire on exit? below is a shot of my php.ini... can anyone see any problems with my setup?.. thanks Quote Link to comment Share on other sites More sharing options...
jacko310592 Posted September 3, 2010 Author Share Posted September 3, 2010 unless anyone can suggest a better way, ill have to go with the suggested answer from this post i just found: http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes ...which basically says to record a time stamp (and update it on user activity), then if there hasn't been any activity for X amount of time, then unset/destroy the session Quote Link to comment Share on other sites More sharing options...
jacko310592 Posted September 3, 2010 Author Share Posted September 3, 2010 now ive found another problem.. after doing as the post on stackoverflow.com suggests, i found that when using session_destroy() or unset($_SESSION['blah']) all they do is remove all the data inside the session, but leave the empty session file behind... how do i remove the file too? ...otherwise im going to have a folder full of old, empty files will i just have to use unlink('/home/jacko/LocalHost/sess/sess_[sESSION ID HERE]') ..or is there a php session setting for removing empty sessions? thanks Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 3, 2010 Share Posted September 3, 2010 Old session data files are removed by session garbage collection, which runs randomly based on session.gc_probability and session.gc_divisor when you execute session_start() statements. Rather that rely on incomplete bits and pieces of information you find posted around on the Internet, you should read the relevant section of the php.net documentation to find out the full story for whatever you are attempting to do with php. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.