session expires to soon in php
- by user1669425
I want to extend a session time so that a session variable does not expire until after 12 hours. Problem is that after 24 minutes (default time for a session until it expires) of inactivity it still expires the session and hence gives me undefined indexes for those SESSION variables.
What else do I need to do in the code below in order to be able to extend the sessions so that it does not expire on its own until 12 hours has passed:
<?php
ini_set('session.gc_maxlifetime',12*60*60);
ini_set('session.cookie_lifetime',12*60*60);
phpinfo();
session_start();
....//rest of code below
?>
in phpinfo() it states this below for gc_maxlifetime:
Local Value Master Value
session.gc_maxlifetime 43200 1440
session.cookie_lifetime 43200 0