Skip to content

Instantly share code, notes, and snippets.

View GregoireHebert's full-sized avatar
:octocat:
Probably somewhere sipping a beer

Grégoire Hébert GregoireHebert

:octocat:
Probably somewhere sipping a beer
View GitHub Profile
@GregoireHebert
GregoireHebert / mysqlsesslock
Created November 25, 2013 20:40
Custom handler, mysql, one row per session, with a mysql advisory lock per session and per var. the "standard" session handler one would write to store session data in a MySQL database. Each row stores the data for one session, the serialized session data is stored in a field of type text. Before the session is read, a mysql advisory lock is acq…
<?php
/* ------------------------------------------------------------------------
* session_mysql.php
* ------------------------------------------------------------------------
* PHP4 MySQL Session Handler
* Version 1.00
* by Ying Zhang (ying@zippydesign.com)
* Last Modified: May 21 2000
* Modified in 2006 by Andy Bakun (abakun ! thwartedefforts , org) to