Jump to content

Recommended Posts

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>";

}

?>

Link to comment
https://forums.phpfreaks.com/topic/128558-yahoo-small-business-session-timeout/
Share on other sites

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.

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');

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.)

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.