Jump to content

manually setting session timeout


r-it

Recommended Posts

Helo there,

I wonder if anyone can help me, i have this code that sets a session to be 60 minutes:

$_SESSION['goobly'] = $user;
ini_set(’session.gc_maxlifetime’, 30*60);

 

but then the person i was developing this for left their pc for 30 minutes and the session expired, so i set it to:

$_SESSION['goobly'] = $user;
ini_set('session.gc_maxlifetime', 1200*600);

 

and the same thing is happening, am I doing something wrong??

Link to comment
https://forums.phpfreaks.com/topic/117537-manually-setting-session-timeout/
Share on other sites

To start with, you must set session.gc_maxlifetime before session_start() (like it states in the php manual) and your posted code implies you are attempting to do it after.

 

Also, the shortest session.gc_maxlifetime of all the scripts running on the same server wins. If you are on a shared server, you must set the session.save_path (again before every session_start()) to point to a private folder within your account's space so that your session.gc_maxlifetime setting will only affect your session data files.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.