n3mesis125 Posted October 15, 2008 Share Posted October 15, 2008 Hey Folks, I don't know what to do for the life of me, I'm hosting with yahoo smallbusiness (probably my biggest problem) and my sessions expire when users are logged in. I set the below code in a sessions.inc file and its on all my pages but everything still timeouts, is there someway I can turn off sessions expiring for good and when my users logout it will close the session (which I already do)? <?PHP ini_set('session.gc_maxlifetime', 94608000); session_save_path('/sessions'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); if (isset($_GET['sid'])) { session_id($_GET['sid']); } if (isset($_POST['sid'])) { session_id($_POST['sid']); } session_start(); if (!$_SESSION) { echo "<script language='javascript'>"; echo "top.redirMain();"; echo "</script>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/ Share on other sites More sharing options...
revraz Posted October 15, 2008 Share Posted October 15, 2008 How fast do they time out? How are you validating they are timing out? Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666239 Share on other sites More sharing options...
n3mesis125 Posted October 15, 2008 Author Share Posted October 15, 2008 I check with if(!$_SESSION) to validate if there are any sessions set if not it bumps back to login screen, sometimes they are timing out after 30 minutes, 1hr, i think I may have found a fix with set_time_limit(0) though, gonna test Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666247 Share on other sites More sharing options...
revraz Posted October 15, 2008 Share Posted October 15, 2008 Does this shared host offer you your own PHP.INI file? Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666252 Share on other sites More sharing options...
n3mesis125 Posted October 15, 2008 Author Share Posted October 15, 2008 unfortunately not, its yahoo smallbusiness hosting Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666256 Share on other sites More sharing options...
n3mesis125 Posted October 15, 2008 Author Share Posted October 15, 2008 Anyone else have any ideas for shutting off the garbage collector and expiring of sessions, my host does not allow for my own php.ini or .htaccess. I've tried ini_set() to set the maxlifetime, nothing seems to be working right, my sessions just expire every so often and I don't want them to expire at all until the user logs out, its crucial because I'm logging peoples login/logout times for work to track shifts. Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666265 Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2008 Share Posted October 15, 2008 The following statement referrers to a folder called session in the root of the current disk - session_save_path('/sessions'); I seriously doubt you have access to the root of the current disk to put a folder there. If you add an echo to that statement, it will show what the actual save path is or was set to - echo session_save_path('/sessions'); Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666403 Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2008 Share Posted October 15, 2008 Slight correction to the above, you need a separate echo of the session_save_path(); after the first one to see if the value was actually changed - session_save_path('/sessions'); echo session_save_path(); The way I first showed, would echo the starting value and then set it to the new value (if the new folder exists.) Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666459 Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2008 Share Posted October 15, 2008 Third time. The session_save_path is just a setting. You can set it to anything and the setting will show that value. The real test is when the session_start() attempts to use the new setting and the folder does not exist. Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666472 Share on other sites More sharing options...
PFMaBiSmAd Posted October 15, 2008 Share Posted October 15, 2008 I would be interested to see what your code does when you add the following two lines immediately after your first opening <?php tag in your main file - ini_set ("display_errors", "1"); error_reporting(E_ALL); For the posted code and the symptoms you have described, it is acting like the session.auto_start setting is on. Quote Link to comment https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/#findComment-666520 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.