UPDATE
PHP ini settings
Directive | Local Value | Master Value
session.auto_start Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file /dev/urandom /dev/urandom
session.entropy_length 32 32
session.gc_divisor 1 1
session.gc_maxlifetime 3 3
session.gc_probability 1 1
Any help is much appreciated. Thanks.
ORIGINAL
I have tried about 15 different methods, through resaearch and past stack overflow posts, and the result is still the same, I am logged out of the session after 5-10 mins of going inactive
All I want to achieve is to stay logged in for a long time...
.htaccess
<IfModule mod_php7.c>
#Session timeout
php_value session.cookie_lifetime "3600000"
php_value session.gc_maxlifetime "3600000"
</IfModule>
php
ini_set('session.gc_maxlifetime', 3600000);
ini_set('session.cookie_lifetime', 3600000);
session_start();
if(!isset($_SESSION["username"])){
header("Location: admin-login.php");
exit();
}
if (isset($_SESSION['username']) && (time() - $_SESSION['username'] > 3600000)) {
// last request was more than 30 minutes ago
session_unset(); // unset $_SESSION variable for the run-time
session_destroy(); // destroy session data in storage
}
$_SESSION['username'] = time(); // update last activity time stamp
phpinfo()
. Look for a setting which could mean 10 minutes(e.g. 600 seconds). We can't guess from our side what is happening to your sessions. – Dharman