Page 1 of 1

session Max life time

Posted: Tue Sep 25, 2007 9:25 am
by vinoth
Hi
Now I am working with Sessions..
I have some doubt regarding that..

What is the max time we assign for session?

Is their any restriction or not..?

Please provide guidelines & suggestion regarding this.

Posted: Tue Sep 25, 2007 9:59 am
by feyd
As much as you wish.

Finding Defaults

Posted: Tue Sep 25, 2007 4:37 pm
by EricS
Running the phpinfo() function will show you what your current session life time is. Remember, it's measured in seconds.

Code: Select all

phpinfo();
You can then adjust it using

1) ini_set()
2) a php directive in .htaccess
3) in your httpd.conf file
4) in the php.ini itself.

Which one you use depends on your needs and/or your permissions.

Posted: Wed Sep 26, 2007 9:29 am
by vinoth
ya

Currently i am using
ini_set() for set the session life time..

Which one is the best I can use ? Or everything works for same..

Posted: Wed Sep 26, 2007 9:59 am
by feyd
ini_set() is quite temporal and doesn't truely affect PHP's internal processes much in this regard.

It's often suggested to do it yourself artificially by storing a timestamp in the session so your code knows when to destroy it rather than hoping PHP will (since it's a triggered event.)

Posted: Thu Oct 04, 2007 5:58 am
by vinoth
hi all

Sorry for late reply..

I set the session Maxlife time as one hour but the client was not satisfied with that.

He does not want an Auto logout.. it should logout after the user clikck the logout button.

Is there any possible way to do that..

Posted: Thu Oct 04, 2007 6:02 am
by VladSun
How many clients will you have?

Posted: Thu Oct 04, 2007 6:53 am
by vinoth
hi Viadsun

one client only make so many changes on daily updations..

Is it any possible way to solve this problem

Posted: Thu Oct 04, 2007 7:01 am
by VladSun

Posted: Fri Oct 05, 2007 12:50 am
by vinoth
Is there any way to prevent session logout until the browser was closed

Posted: Fri Oct 05, 2007 10:18 am
by feyd
Set the life time our a long time.. maybe a month or five. Make sure the cookie is a session cookie (the expiry time is zero in session cookies.)

It's easier to control if you shift the handling out of PHP's direct, autonomous control like to a database.