Skip navigation.

New Improved Yummy ADOdb Session Handler

ADOdb, the database library i maintain, has had support for storing session data in a database for a long time. However there was one limitation that always continued to bug me: the fact that all the PHP servers using database-backed sessions needed to synchronize their times to ensure that the session timers worked properly.

Well in the latest version of ADOdb (4.91), released a few days ago, we have the new Session2 implementation. This time, we always use the database server clock to keep track of times. We no longer rely on the PHP app servers to set the session timers, so even if the clocks of these app servers are out of synch, sessions are not affected. This change required us to change the database table format used, but that is a small price to pay for the added flexibility. You can read more in the ADOdb session docs.

Usage is really simple:

include_once("adodb/session/adodb-session2.php");
ADOdb_Session::config($driver='mysql', $host, $user, $password, $database,$options=false);
session_start();