0

I am very new to PHP. I am trying to develop a website with a database. It's all seems good till sometime before, but recently I am facing a very critical problem. After a successful login, within 5-6 seconds, the session is getting expired! I an unable to get solution for that, I have tried to change the session.gc_maxlifetime value, but it is not working! session.save_path is set to /tmp max_execution_time = 259200, max_input_time = 259200, max_input_vars = 100, session.gc_maxlifetime = 1440

Please help me to solve the problem!

0

Have you tried something like that?

$duration=60 * 60 * 24 * 7; // One week (in reality I think it does not last so long. 
if (!isset($_SESSION)) { session_start(['cookie_lifetime' => $duration]); }

Also check this, and this. Documentation

6
  • Should I write those lines where I am starting the session [session_start();] ?
    – Nandik Roy
    Aug 20 '19 at 11:33
  • If yes, still not working! Getting expired in 5 sec!
    – Nandik Roy
    Aug 20 '19 at 11:34
  • I have check for other values too...
    – Nandik Roy
    Aug 20 '19 at 11:35
  • session.cache_expire = 180, session.cache_limiter = nocache, session.cookie_lifetime = 0, session.cookie_path = /, session.gc_divisor = 0, session.gc_maxlifetime = 1440, session.gc_probability = 1, session.save_path = /tmp
    – Nandik Roy
    Aug 20 '19 at 11:35
  • check if that are helping or not!
    – Nandik Roy
    Aug 20 '19 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.