SharkBait Posted May 3, 2006 Share Posted May 3, 2006 Hi, I've been using a session for a particular website and it seems to be timing out. Not sure why, I thought by designed sessions do not timeout until the browser is closed.I havent timed it but they do seem to expire after a while.Does the php.ini file have anything to do with this?These are the session settings in the php.ini file[code]session.save_path = /tmpsession.use_cookies = 1session.cookie_lifetime = 0session.cookie_path = /session.gc_maxlifetime = 1440[/code]So looking over that it seems that every 24min the GC will do its things with session. But then because the session.save_path is set, the GC doesnt do this automatically without a cron job.Whats going on? Quote Link to comment Share on other sites More sharing options...
ober Posted May 3, 2006 Share Posted May 3, 2006 It's all in the manual:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]session.gc_maxlifetime integersession.gc_maxlifetime specifies the number of seconds after which data will be seen as 'garbage' and cleaned up. Note: If different scripts have different values of session.gc_maxlifetime but share the same place for storing the session data then the script with the minimum value will be cleaning the data. In this case, use this directive together with session.save_path. Note: If you are using the default file-based session handler, your filesystem must keep track of access times (atime). Windows FAT does not so you will have to come up with another way to handle garbage collecting your session if you are stuck with a FAT filesystem or any other filesystem where atime tracking is not available. Since PHP 4.2.3 it has used mtime (modified date) instead of atime. So, you won't have problems with filesystems where atime tracking is not available.[/quote] Quote Link to comment Share on other sites More sharing options...
SharkBait Posted May 3, 2006 Author Share Posted May 3, 2006 [!--quoteo(post=370951:date=May 3 2006, 10:02 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 3 2006, 10:02 AM) [snapback]370951[/snapback][/div][div class=\'quotemain\'][!--quotec--]It's all in the manual:[/quote]I understand the the GC does its thing. But I am trying to figure out what setting I have that makes the sessions timeout. There are no cron jobs that are clearing them. I've compared the php.ini file on my server and the one I on my development serverBoth are the same. but the development server, the sessions do not timeout. My scripts don't manual change the GC timeout either.*shrug* Quote Link to comment Share on other sites More sharing options...
ansarka Posted May 4, 2006 Share Posted May 4, 2006 [!--quoteo(post=371006:date=May 3 2006, 01:51 PM:name=SharkBait)--][div class=\'quotetop\']QUOTE(SharkBait @ May 3 2006, 01:51 PM) [snapback]371006[/snapback][/div][div class=\'quotemain\'][!--quotec--]I understand the the GC does its thing. But I am trying to figure out what setting I have that makes the sessions timeout. There are no cron jobs that are clearing them. I've compared the php.ini file on my server and the one I on my development serverBoth are the same. but the development server, the sessions do not timeout. My scripts don't manual change the GC timeout either.*shrug*[/quote]Are you sure teh session.gc_maxlifetime in your server and devlopment server is same i think you are worng session.gc_maxlifetime = 1440If so can send the code you are using Quote Link to comment Share on other sites More sharing options...
SharkBait Posted May 4, 2006 Author Share Posted May 4, 2006 [!--quoteo(post=371198:date=May 4 2006, 03:41 AM:name=anuka)--][div class=\'quotetop\']QUOTE(anuka @ May 4 2006, 03:41 AM) [snapback]371198[/snapback][/div][div class=\'quotemain\'][!--quotec--]Are you sure teh session.gc_maxlifetime in your server and devlopment server is same i think you are worng session.gc_maxlifetime = 1440If so can send the code you are using[/quote]I increased the maxlifetime to 24hrs and it seems to of done the trick. I guess I just got confused in the comments on the php.ini file I had :) 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.