423,850 Members | 1,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,850 IT Pros & Developers. It's quick & easy.

how to set session timeout in php.ini file?

100+
P: 127
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
Share this Question
Share on Google+
6 Replies


Shenno
P: 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
P: 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

100+
P: 127
where i put this in my php code or in php.ini file?
Nov 16 '10 #4

Shenno
P: 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

P: 1
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

P: 1
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.