469,330 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,330 developers. It's quick & easy.

how to set session timeout in php.ini file?

127 100+
in php.ini file...
Expand|Select|Wrap|Line Numbers
  1. session.gc_maxlifetime = 1440
  2.  
if i change the value it doesnt work... i set the
Expand|Select|Wrap|Line Numbers
  1. session.gc_maxlifetime = 3600
  2.  
but it doesnt work...
how to set session timeout to one hour?
plz help...
Nov 15 '10 #1
6 38607
Shenno
59
// php.ini setting required for session timeout.

ini_set(‘session.gc_maxlifetime’,60*60);
ini_set(‘session.gc_probability’,1);
ini_set(‘session.gc_divisor’,1);


u can use ini_get function to see if your changes has been saved.

hope this helps.
Nov 15 '10 #2
Shenno
59
// php.ini setting required for session timeout.

ini_set(‘session.gc_maxlifetime’,60*60);
ini_set(‘session.gc_probability’,1);
ini_set(‘session.gc_divisor’,1);


u can use ini_get function to see if your changes has been saved.

hope this helps.
Nov 15 '10 #3
impin
127 100+
where i put this in my php code or in php.ini file?
Nov 16 '10 #4
Shenno
59
if u have access to php.ini file, search the for

session.gc_maxlifetime
session.gc_probability
session.gc_divisor


and set there values as mentioned in the functions

other thing i've remembered may be the line are comments. remove # before the line
Nov 16 '10 #5
i want to set session time out 5 mint....
how to change
ini_set(‘session.gc_maxlifetime’,60*60);
ini_set(‘session.gc_probability’,1);
ini_set(‘session.gc_divisor’,1);

according to my need
Jun 6 '16 #6
ini_set(‘session.gc_maxlifetime’,60*5);
for 5 minutes.

value is in seconds. you can also give like this,
ini_set(‘session.gc_maxlifetime’,300);

Note: Restart Apache once done the modification. Then only it will reflect.
Dec 29 '17 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Geigho | last post: by
4 posts views Thread by Nedu N | last post: by
3 posts views Thread by Jim Heavey | last post: by
reply views Thread by LearninGuru | last post: by
4 posts views Thread by DavidS | last post: by
8 posts views Thread by bdeviled | last post: by
2 posts views Thread by Rajesh.jain25 | last post: by
4 posts views Thread by Vanessa | last post: by
2 posts views Thread by Aryan | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.