Joomla! Discussion Forums



It is currently Thu Nov 26, 2009 11:22 am (All times are UTC )

 




Post new topic Reply to topic  [ 8 posts ] 
Author Message
Posted: Fri Nov 18, 2005 1:29 am 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Thu Aug 18, 2005 8:23 pm
Posts: 173
Location: New York, NY
I load-balance Joomla across 3 webservers and would commonly run into getting logged out due to my load-balancer deciding I would visit the server that didn't have my session file.  Annoying, right?  Sure is.  Well, I fixed my problem by creating persistent connections through the load-balancer.  But for those of you who don't have that luxury (like being hosted on SourceForge, I believe), I've created a session handler that stores all sessions in the database.  I wouldn't quite call this stable because I've only been able to test it on my development servers (the garbage collector may be iffy, if anything.)  I've attached the file and included the edit you need to make and the table structure.

Please note that will probably have worse performance than PHP's built-in session handling, so I'd only advise this solution for people who need it.  This can be useful for load-balanced setups or installations that do not have write permissions on the filesystem.  If your current setup is working fine with PHP's built-in sessions, don't waste your time installing this.

Database structure:
REPLACE #_ WITH YOUR TABLE PREFIX (jos or mos, commonly)!!!
Code:
CREATE TABLE `#__sessions` (
`id` varchar(40) NOT NULL,
`time` TIMESTAMP NOT NULL DEFAULT NOW(),
`data` text NOT NULL,
PRIMARY KEY  (`id`)
) TYPE=MyISAM;


Insert this line into joomla.php
Code:
require_once( $mosConfig_absolute_path . '/includes/session_handler.php'); //hack by gharding[@gmail.com]

after this code (should be after line 82):
Code:
require_once( $mosConfig_absolute_path . '/includes/version.php' );
require_once( $mosConfig_absolute_path . '/includes/database.php' );
require_once( $mosConfig_absolute_path . '/includes/gacl.class.php' );
require_once( $mosConfig_absolute_path . '/includes/gacl_api.class.php' );
require_once( $mosConfig_absolute_path . '/includes/phpmailer/class.phpmailer.php' );
require_once( $mosConfig_absolute_path . '/includes/joomla.xml.php' );
require_once( $mosConfig_absolute_path . '/includes/phpInputFilter/class.inputfilter.php' );



Upload session_handler.php to /includes/session_handler.php

Good luck.  Please email/pm/reply with feedback!


You do not have the required permissions to view the files attached to this post.


Last edited by gharding on Fri Nov 18, 2005 3:37 am, edited 1 time in total.

Top
  E-mail  
 
Posted: Tue Jan 31, 2006 11:58 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Sep 14, 2005 6:18 am
Posts: 13
Location: Lofoten - Norway
Where are the answers to this post? This looks like a nice solution to increase the performance of Joomla.  Have anybody tried this?


Top
  E-mail  
 
Posted: Tue Jan 31, 2006 11:15 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Thu Aug 18, 2005 8:23 pm
Posts: 173
Location: New York, NY
I imagine it's actually worse for performance (more queries = more time), but useful if you're not totally maxing out your resources.  I submitted a feature request with this and I think they said Joomla would provide a little framework for stuff like that, so I guess it's going to wait (understandable, as who wants to add kludge when you're working to remove it?)


Top
  E-mail  
 
Posted: Thu Feb 01, 2007 5:02 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Nov 05, 2005 7:16 pm
Posts: 31
gharding wrote:
I imagine it's actually worse for performance (more queries = more time), but useful if you're not totally maxing out your resources.  I submitted a feature request with this and I think they said Joomla would provide a little framework for stuff like that, so I guess it's going to wait (understandable, as who wants to add kludge when you're working to remove it?)


NICE! And Powerful. Its only used in my Backend (frontend is no problem in load balancing scenarios). But backend now FINALLY works after 9 months of searching a solution


Top
   
 
Posted: Thu Feb 01, 2007 5:33 pm 
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Thu Aug 18, 2005 8:23 pm
Posts: 173
Location: New York, NY
Looks like this (or something similar) is making it into 1.5:

http://forge.joomla.org/sf/go/artf2179


Top
  E-mail  
 
Posted: Wed Jan 09, 2008 8:32 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri May 04, 2007 1:54 pm
Posts: 8
Sorry to dig up an old topic, but I've tried this on 1.0.13 and can't get it to work.  If I remove the "include" from joomla.php, I'll get bounced out of the backend as soon as my webserver (lighttpd) decides I should be served by a different PHP backend.  If I add the "include" into joomla.php, it just bounces me out directly on login.  I've checked the "jos_sessions" table after trying to log in and there are no entries, so it appears that they aren't being stored.

Anyone have any luck on 1.0.13?


Top
   
 
Posted: Wed Jan 09, 2008 8:49 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sat Nov 05, 2005 7:16 pm
Posts: 31
jawatkin wrote:
Sorry to dig up an old topic, but I've tried this on 1.0.13 and can't get it to work.  If I remove the "include" from joomla.php, I'll get bounced out of the backend as soon as my webserver (lighttpd) decides I should be served by a different PHP backend.  If I add the "include" into joomla.php, it just bounces me out directly on login.  I've checked the "jos_sessions" table after trying to log in and there are no entries, so it appears that they aren't being stored.

Anyone have any luck on 1.0.13?


This was written for the Old Joomla System, it is NOT FUNCTIONAL in the New System since 1.0.x. I wrote the author but he has nothing to do with joomla anymore, so no new version is coming up from him.


Top
   
 
Posted: Thu Jan 10, 2008 9:59 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri May 04, 2007 1:54 pm
Posts: 8
Milchi wrote:
This was written for the Old Joomla System, it is NOT FUNCTIONAL in the New System since 1.0.x. I wrote the author but he has nothing to do with joomla anymore, so no new version is coming up from him.


Thanks for the info.  Any other solutions (other than going to 1.5, which I've been told fixes this... it does right?)?


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group