Projects / Zebra_Session


Zebra_Session is a PHP class that acts as a wrapper for PHP’s default session handling functions. Instead of storing session data in flat files, it stores them in a MySQL database, thus providing both better security and better performance. The Zebra_Session class is also a solution for applications that are scaled across multiple Web servers (using a load balancer or a round-robin DNS) and where the user’s session data needs to be available, since storing sessions in a database makes them available to all of the servers. Zebra_Session‘s code is heavily commented and generates no warnings, errors, or notices when PHP’s error reporting level is set to E_ALL.

Operating Systems

Recent releases

  •  28 Jan 2013 16:22

    Release Notes: This release fixes a bug which made sessions' lifetimes twice as long as expected, adds details on how to preserve session data across subdomains to the documentation, and makes the messages related to database connection errors more meaningful.

    •  15 Oct 2011 06:48

      Release Notes: The constructor method now accepts an optional link argument which must be a MySQL link identifier. By default, the library made use of the last link opened by mysql_connect(). On some environments (particularly on shared hosting) the "last link opened by mysql_connect" was not available at the time of the instantiation of the Zebra_Session library. For these cases, supplying the MySQL link identifier to the constructor method will fix things. The documentation was corrected and expanded.

      •  18 Apr 2011 14:48

        Release Notes: This release implements session locking, a way to ensure that data is correctly handled in a scenario with multiple concurrent AJAX requests.

        •  02 Jan 2011 14:49

          Release Notes: This release fixes a small bug in the destroy method: the script would trigger a PHP notice if the HTTP_USER_AGENT value was not available in the $_SERVER super-global. It adds a new method “get_settings” that returns the default session-related settings for the environment where the class is used. The class will now trigger a fatal error if a database connection is not available. The class will now report if MySQL table is not available. The constructor of the class now accepts a new argument, tableName; with this, the MySQL table used by the class can be changed.

          •  17 Sep 2007 17:49

            Release Notes: 'LIMIT 1' has been added to the read() method, increasing the performance of the script.


            Project Spotlight


            A Fluent OpenStack client API for Java.


            Project Spotlight

            TurnKey TWiki Appliance

            A TWiki appliance that is easy to use and lightweight.