Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Session across multiple servers...

edited November 2009 in Vanilla 1.0 Help
So, I want to have vanilla running on two servers reading from one db, or close enough for this. The sessions are causing a problem since they are not shared accross servers.

Now, the hacked solution would be to use mysqlfs and use sessiion_save_path() somewhere in the code -- I would assume this would be in vanilla/cappg/ somewhere. This would work but not be that elegant. Is there a Vanilla configuration option for this already?

A better solution would be to store the session within the LUM_Users table or a new table in LUM_session (say). This would be quiet a lot more complicated to code since I know nothing of php whatsoever. So, is there an addon that does it? I could not find one but that does not mean there is not. Otherwise, would it actually be hard to do and still not mess up any future vanilla1 update?

Comments?

Comments

  • edited November 2009
    @Mark,

    Here is a patch for Vanilla that allows it to set the session path to a directory which can then be a NFS or mysqlfs mount.

    First, add
    $Configuration['SESSION_SAVE_PATH'] = '/tmp/vanilla/';
    to the vanilla/conf/settings.conf file.

    Second, patch vanilla/library/People with the following. The forum did not paste this correctly and I cannot work out what the right tags are to make this into code. @Admin feel free to edit my post and put some tags in there.

    Alternatively, I can email you the patch.

    *** People.Class.Session.php.old Thu Nov 26 09:42:50 2009
    --- People.Class.Session.php Thu Nov 26 09:42:44 2009
    ***************
    *** 140,145 ****
    --- 140,150 ----
    if ($Context->Configuration['SESSION_NAME']) {
    session_name($Context->Configuration['SESSION_NAME']);
    }
    + // Check if SESSION_SAVE_PATH is set in $Configuration or not.
    + if (true == array_key_exists('SESSION_SAVE_PATH', $Context->$Configuration))
    + {
    + session_save_path($Context->$Configuration['SESSION_SAVE_PATH']);
    + }
    session_start();
    setcookie(session_name(), session_id(), null,
    $Context->Configuration['COOKIE_PATH'],
    ***************
    *** 158,164 ****
    * @param int $UserID
    */
    function Start(&$Context, $Authenticator, $UserID = '0') {
    ! $this->StartSession($Context);

    // If the UserID is not explicitly defined (ie. by some vanilla-based login module),
    // retrieve the authenticated UserID from the Authenticator module.
    --- 163,169 ----
    * @param int $UserID
    */
    function Start(&$Context, $Authenticator, $UserID = '0') {
    ! $this->StartSession($Context);

    // If the UserID is not explicitly defined (ie. by some vanilla-based login module),
    // retrieve the authenticated UserID from the Authenticator module.
    ***************
    *** 200,208 ****
    session_set_cookie_params(0, $Context->Configuration['COOKIE_PATH'],
    $Context->Configuration['COOKIE_DOMAIN'], $UseSsl);
    }
    session_start();
    }
    ! }

    }
    ?>
    --- 205,218 ----
    session_set_cookie_params(0, $Context->Configuration['COOKIE_PATH'],
    $Context->Configuration['COOKIE_DOMAIN'], $UseSsl);
    }
    + // Check if SESSION_SAVE_PATH is set in or not.
    + if (true == array_key_exists('SESSION_SAVE_PATH', $Context->Configuration))
    + {
    + session_save_path($Context->Configuration['SESSION_SAVE_PATH']);
    + }
    session_start();
    }
    ! }

    }
    ?>
  • For vanilla 1 you can post the patch on the issue tracker:
    http://code.google.com/p/lussumo-vanilla/issues/list

    (In you case would it be easier to edit php.ini to set the session.save_path?)
  • @Dinoboff, sadly this does not work as we have more than one php application running on the cluster and they need to have separate mysqlfs. But overall a good idea.

    Thanks for the link.
  • If you wanted to set a different session handler, check this extension:
    http://vanillaforums.org/addon/416/db-session

    It replace Vanilla session handler with Zend_Session.
Sign In or Register to comment.