$_SESSION lost data after idle for few hour in PHP

204 views Asked by At

I have stored the temp data in $_SESSION like this:

session_start();
$_SESSION['userdetail'] = $user_id;

The session is an array like that:

array(2) { ["RF"]=> array(7) { ["verify"]=> string(21) "RESPONSIVEfilemanager" ["subfolder"]=> string(0) "" ["view_type"]=> int(0) ["sort_by"]=> string(4) "name" ["descending"]=> bool(false) ["language"]=> string(5) "en_EN" ["language_file"]=> string(14) "lang/en_EN.php" } ["userdetail"]=> string(1) "1" }

The problem is , if I idle the computer to ~1 to 2 hour , then the $_SESSION['userdetail'] lost, notice that not all data lost, but only the userdetail.

array(1) { ["RF"]=> array(7) { ["verify"]=> string(21) "RESPONSIVEfilemanager" ["subfolder"]=> string(0) "" ["view_type"]=> int(0) ["sort_by"]=> string(4) "name" ["descending"]=> bool(false) ["language"]=> string(5) "en_EN" ["language_file"]=> string(14) "lang/en_EN.php" } } 

Checked the php.ini settings:

session.cookie_lifetime is 0

session.gc_maxlifetime is 1440

How to fix that? I would like to keep the data at least 12 hours, Thanks a lot.

0

There are 0 answers