exally Posted March 11, 2009 Share Posted March 11, 2009 Hey guys, I can't seem to get my PHP sessions to stay alive longer than 5 mins of inactivity. I have set session.gc_maxlifetime 86400 session.cookie_lifetime 86400 session.name FILEITHERE (i do this as a test, still doens't work). Any ideas ?? Quote Link to comment Share on other sites More sharing options...
WolfRage Posted March 11, 2009 Share Posted March 11, 2009 This will have to be incldue on every page. <?php ini_set('session.gc_maxlifetime',86400); ini_set('session.cookie_lifetime',86400); session_name('FILEITHERE); ?> Quote Link to comment Share on other sites More sharing options...
exally Posted March 11, 2009 Author Share Posted March 11, 2009 This will have to be incldue on every page. <?php ini_set('session.gc_maxlifetime',86400); ini_set('session.cookie_lifetime',86400); session_name('FILEITHERE); ?> unfortunately my server has disabled this method, however i have put this in my .htaccess file and appears correctly when i do phpinfo() and each page where i call session_start() Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted March 11, 2009 Share Posted March 11, 2009 If you are on a shared web server, the shortest session.gc_maxlifetime of all the scripts running on the server wins. To get your session.gc_maxlifetime setting to apply only to your session data files, you must set session.save_path to be to a private folder within your account's folder tree so that your session data files are stored separately. Quote Link to comment Share on other sites More sharing options...
exally Posted March 11, 2009 Author Share Posted March 11, 2009 If you are on a shared web server, the shortest session.gc_maxlifetime of all the scripts running on the server wins. To get your session.gc_maxlifetime setting to apply only to your session data files, you must set session.save_path to be to a private folder within your account's folder tree so that your session data files are stored separately. in order to be sure, I assume that the files are stored in /tmp - would it be better to create /tmp/custom or /tmp2 Also do i have to create the folder and set certain permissions or would PHP handle that? Quote Link to comment Share on other sites More sharing options...
exally Posted March 11, 2009 Author Share Posted March 11, 2009 If you are on a shared web server, the shortest session.gc_maxlifetime of all the scripts running on the server wins. To get your session.gc_maxlifetime setting to apply only to your session data files, you must set session.save_path to be to a private folder within your account's folder tree so that your session data files are stored separately. thanks, testing this now! It does make sense as we are sharing the server but not the document root if you get me. we are home2 where i assume there is a home Quote Link to comment Share on other sites More sharing options...
WolfRage Posted March 11, 2009 Share Posted March 11, 2009 You need to apply the proper setting to the folder yourself, which should be some thing along the lines of no public access and only read, write, executable by the scripts. The folder should ideally be hidden from the web, and thus only accessable by the scripts and you as the ftp admin. Quote Link to comment 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.