View Full Version : Altering PHP Session Timeouts
ericianfish
01-14-2009, 10:40 AM
I have tried several ways to alter PHP session timeouts. I want to make the setting longer than the default (which appears to be 1440 seconds, or 24 minutes). I tried the following in my login script:
<?php
ini_set("gc_maxlifetime", 24 * 60 * 60 * 5); // 5 days
?>
This didn't seem to have an effect. Have read forum post fragments that suggest hosted environments pose some challenges here. Would like to set this programmatically rather than editing php ini files (not sure how that works either).
Thanks
try:
ini_set('session.gc_maxlifetime',24 * 60 * 60 * 5);
ericianfish
01-14-2009, 06:39 PM
Here's the actual fragment (I mis-typed in the first forum post). The following seems to have no effect.
ini_set("session.gc_maxlifetime", 60 * 60 * 24 * 5);
since session.gc_maxlifetime is a server wide thing, try also changing your session save path to a directory within your account.
ericianfish
01-15-2009, 12:24 PM
When you say server wide, does this mean that other customers on the same server can effectively mess with these settings? Do the session variables then have possible collision issues with other customers too? Is there a place all of this is documented clearly? I haven't come across anything like that. Wondering if I have to roll my own sessions, that would be pretty painful at this point.
ericianfish
01-15-2009, 12:27 PM
Also, not sure which directory they could use for the save path directory (is this relative to my base path, or some global path; don't know what to specify). And not sure how this would matter, if the session timeout is unchanged (is it written to the save path). What is saved there - session parameters (e.g. gc_max_lifetime), session variables, or both?
the session time out is server wide and only can be set by an admin. that's why when you try to change it, it does nothing. Sessions are unique and shouldn't ever have collisions.
I've read on other forums that if you changed the session save path to be within your account it should work. Set the path to something like /home/[username]/sessions. This will save a file with the sessions variables.
You should contact HM support to verify if this will even work.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.