I have the following session timeout setup:
$inactive = $Timeout;
// check to see if $_SESSION['timeout'] is set
if(isset($_SESSION['timeout']) ) {
$session_life = time() - $_SESSION['timeout'];
if($session_life > $inactive) {
session_destroy();
header("Location: index.php?page=login");
}
}
$Timeout is obtained from a database entry. At the moment it is set to 1800.
And every time a user clicks on a link or carries out an action, I do
$_SESSION['timeout'] = time();
On MAMP it’s working as expected, and the session is expiring after 30 minutes of inactivity.
On the hosted account (ipower) it seems to be timing out after about 5 mins of inactivity.
I am stumped as to what could be causing this? Has anyone experienced something like this? What settings could I check?
Probably you have session.gc_maxlifetime set to different value on your MAMP and on other hosting environment session.gc_maxlifetime is set to default value.
See http://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime
I did some search and it seems to be a problem with ipower try this,
In order to run PHP sessions on iPower, you must add the following line of code to the top of any PHP script that uses sessions: