Jump to content


Photo

Session Timeout?


  • Please log in to reply
4 replies to this topic

#1 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 03 May 2006 - 02:30 PM

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

session.save_path = /tmp
session.use_cookies = 1

session.cookie_lifetime = 0
session.cookie_path = /

session.gc_maxlifetime = 1440

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?


#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 03 May 2006 - 05:02 PM

It's all in the manual:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]session.gc_maxlifetime integer

session.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]

Info: PHP Manual


#3 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 03 May 2006 - 06:51 PM

[!--quoteo(post=370951:date=May 3 2006, 10:02 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 3 2006, 10:02 AM) View Post[/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 server

Both are the same. but the development server, the sessions do not timeout.

My scripts don't manual change the GC timeout either.

*shrug*


#4 ansarka

ansarka
  • Members
  • PipPipPip
  • Advanced Member
  • 128 posts
  • LocationCochin, Kerala, India

Posted 04 May 2006 - 10:41 AM

[!--quoteo(post=371006:date=May 3 2006, 01:51 PM:name=SharkBait)--][div class=\'quotetop\']QUOTE(SharkBait @ May 3 2006, 01:51 PM) View Post[/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 server

Both 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 = 1440


If so can send the code you are using

EVEN THE WORD IMPOSSIBLE IS SAYING I' M' POSSIBLE

#5 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 04 May 2006 - 02:25 PM

[!--quoteo(post=371198:date=May 4 2006, 03:41 AM:name=anuka)--][div class=\'quotetop\']QUOTE(anuka @ May 4 2006, 03:41 AM) View Post[/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 = 1440
If 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 :)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users