I am finding that session variables are disappearing after about 30 - 90 minutes. I check that the session has been started in the usual way before retrieving a session variable:
function chkSsn() {
if (session_status() == PHP_SESSION_NONE)
session_start();
}
I am setting the session variables as follows:
function setSsnVar($nm, $vlu) {
chkSsn();
$_SESSION[$nm] = $vlu;
}
And retrieving them as follows:
function ssnVar($nm) {
chkSsn();
if (array_key_exists($nm, $_SESSION))
return $_SESSION[$nm];
else
return "";
}
I tried adding the following lines immediately after "session_start", but it didn't make any difference:
header("Cache-Control: no-cache");
header("Pragma: no-cache");
I am using Firefox 48, Apache/2.4.7 (Ubuntu) and PHP Version 5.5.9-1ubuntu4.19.