By default php session information is stored in directory that is set in php session.save_path setting. This setting can be set in php.ini, webserver config or .htaccess files.
If you want to share session information between two webservers, you can use that directory in some networked file system.
If you prefer database, php session extension provides functions that allow overriding default session storage backend with custom backend functions. See [session-set-save-handler].
[ADOdb] libraries provide easy way to use this function. You only have to load ADOdb includes, session database configuration and ADOdb session includes before every session_start() function call.
In order to avoid need to hunt every session_start() call and modify every script that uses it, you can also use php auto_prepend_file setting and load ADOdb code in that included file.
For example:
1. You create file /some-path/sessiondb.php that contains:
<?php
include_once('/path/to/adodb/adodb.inc.php');
$ADODB_SESSION_DRIVER='some driver';
$ADODB_SESSION_CONNECT='some address';
$ADODB_SESSION_USER ='some username';
$ADODB_SESSION_PWD ='some password';
$ADODB_SESSION_DB ='session database';
include(ADODB_DIR . '/session/adodb-session.php');
?>
2. Then you prepare database for session information. ADOdb v.4.60 provides SQL dumps for MySQL and Oracle.
3. Then you add auto_prepend_file setting to your webserver config.
<directory /usr/share/squirrelmail>
php_value auto_prepend_file "/some-path/sessiondb.php"
# ... other directory options ...
</directory>
4. Restart webserver in order to apply modifications in config and see how your squirrelmail installation starts using database to store session info.
ADOdb session functions also support encryption and compression of session data.
WARNING: it is possible that sessions on networked filesystem or database are slower and there might be some problems with some IMAP servers.