Answer the question
In order to leave comments, you need to log in
Why can't I set session.gc_maxlifetime?
Hello!
Here is part of the configuration:
session.auto_start = 1
session.gc_probability = 100
session.gc_divisor = 1
session.gc_maxlifetime = 100
<?php
//ini_set("session.gc_probability", '100');
//ini_set("session.gc_maxlifetime", '2');
//session_start();
if(isset($_SESSION["count"])){
$_SESSION["count"]++;
}else{
$_SESSION["count"] = 1;
}
print $_SESSION["count"] . "<br>";
print $_COOKIE["PHPSESSID"];
?>
Answer the question
In order to leave comments, you need to log in
If the session is still being accessed, it means that someone still needs it. Since someone needs it - why should it be removed?
https://github.com/php/php-src/blob/PHP-7.2.2/ext/...
Garbage collector how do you run it? No way, and you think that he will magically clean the sessions for you once a second?
Your option only says that if the session is older, then you need to clear it, and when the garbage collector passes there, you don’t set it in any way, maybe it will clean it tomorrow.
Write a program that just cleans sessions by hand once a second
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question