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.phpGood luck. Please email/pm/reply with feedback!