Jump to content

Session Timeout?


SharkBait

Recommended Posts

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 = /tmp
session.use_cookies = 1

session.cookie_lifetime = 0
session.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?
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

[!--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 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*
Link to comment
Share on other sites

[!--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 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
Link to comment
Share on other sites

[!--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 = 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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.