Forum Moderators: coopster
my server just doesn't seem to be timing a session out. If i leave my window on the session just stays alive.
I have tried placing these two lines in my .htaccess.
php_value session.gc_maxlifetime 300
php_value session.cookie_lifetime 300
with these lines in .htaccess session should timeout after 5 minutes but after placing these lines session doesn't even start...
Am i doing something wrong here..?
Thanks
PS I tried phpinfo() after putting these lines in .htaccess and the changes are reflecting.
Session is timing out - how do I increase cookie time? [webmasterworld.com]
I have read the threads u mentioned but my problem is still there. I know the threads you mentioned say that if the site is on a shared server then i need to change the cookie path as well but i'm doing it on my own server.
Actually, now i'm changing the session.gc_maxlifetime and session.cookie_lifetime values directly in my php.ini but whenever i change "session.cookie_lifetime" to anything else then '0', my server stops registering session variables.
any idea why that is..?
Thanks for ur help
On a side note, I tend to leave the setting at 0 which equates to "when the user closes the browser" and manage session timeouts on the server instead. Session garbage collection happens by looking at 3 directives -- the gc (garbage collection) probability, the gc divisor, and the maxlifetime:
session.gc_probability
session.gc_divisor
session.gc_maxlifetime
You should be able to rely on these exclusively but if you want you can always store the timestamp in a session variable and compare that to your timeout value and handle accordingly.
I have not touched session.gc_probability and session.gc_divisor values, they are still set to default which i think is 1000 and 1.