ScrewLooseSalad Posted May 7, 2013 Share Posted May 7, 2013 I've written a basic php application with a login feature, using $_SESSION, but it times out after 20 minutes, how can I change the length of a session? Either in php on the page or in the php files whichever is simpler. Quote Link to comment https://forums.phpfreaks.com/topic/277757-php-session-timeout/ Share on other sites More sharing options...
mac_gyver Posted May 7, 2013 Share Posted May 7, 2013 your need to set session.gc_maxlifetime to a longer value. you must do this before every session_start() statement. if you are on a shared web server, you must also make you own folder for the session data files and set your session.save_path setting to point to the folder. Quote Link to comment https://forums.phpfreaks.com/topic/277757-php-session-timeout/#findComment-1428916 Share on other sites More sharing options...
bacancytech Posted May 14, 2013 Share Posted May 14, 2013 Hi, Here is the code to increase the session time: ini_set('session.gc_maxlifetime', 60 * 60 * 6); May be it will help you for your Problem. Quote Link to comment https://forums.phpfreaks.com/topic/277757-php-session-timeout/#findComment-1429972 Share on other sites More sharing options...
annaharris Posted May 28, 2013 Share Posted May 28, 2013 ini_set('session.gc_maxlifetime', 14400);ini_set('session.gc_probability', 1);ini_set('session.gc_divisor', 100);add above codes in index.php. it will work. Quote Link to comment https://forums.phpfreaks.com/topic/277757-php-session-timeout/#findComment-1432714 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.