How to set session lifetime as infinite
cookies, php, session
Solution
Maybe you can try by setting the expiration time to a very big value? :)
And according what I red on the subject, you'll need more than the line you wrote in your question, something like this:
//set cookie lifetime for 100 days (60sec * 60mins * 24hours * 100days)
ini_set('session.cookie_lifetime', 60 * 60 * 24 * 100);
ini_set('session.gc_maxlifetime', 60 * 60 * 24 * 100);
//maybe you want to precise the save path as well
ini_set('session.save_path', '/home/yoursite/sessions');
//then start the session
session_start();
Good luck!
Problem
How can I set session life time as infinite? There is a settings `session.cookie_lifetime`, but I couldn't find which value I need to set it for infinite lifetime. I have tried 0 but it will expire once browser closed. ``` ini_set('session.cookie_lifetime', 0); ```