the default expire time of session is 1440,i want to reduce this time to 60 second,but when i use ini_set('session.gc_maxlifetime','60')
in the first page it work,but it doesn't work in an other page,
please tell me what is my wrong?
----------index.php-----------
<?php
ini_set('session.gc_maxlifetime','60');
session_start();
$_SESSION['id']='123';
print('<br/><a href="link.php">link<a/>');
?>
----------link.php----------
<?php
session_start();
if(isset($_SESSION['id'])){
ini_set('session.gc_maxlifetime',60);
}else{
header('Location:index.php?ERROR');
}
print('<br/><a href="link.php?1">menu<a/>');
?>
Because garbage collector starts (if starts) before session
So setting ini_set('session.gc_maxlifetime',60);
after session_start()
changes nothing