Custom session handler I'm new to PDO and haven't been coding in a while. Is the following custom session handler industry-acceptable?

class Session {
    protected $sdb;

    function __construct() {
        session_set_save_handler(array($this, '_open'), array($this, '_close'), array($this, '_read'), array($this, '_write'), array($this, '_destroy'), array($this, '_clean'));
        register_shutdown_function('session_write_close');
    }

    function _open() {
        $this-&gt;sdb['conn'] = new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME . ';charset=utf8', DBUSER, DBPASS);
        $this-&gt;sdb['conn']-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        return TRUE;
    }

    function _close() {
        $this-&gt;sdb['conn'] = NULL;

        return TRUE;
    }

    function _read($sid) {
        try {
            $this-&gt;sdb['read']['query'] = $this-&gt;sdb['conn']-&gt;prepare('SELECT data FROM sessions WHERE sid = :sid LIMIT 1')) {
            $this-&gt;sdb['read']['query']-&gt;bindParam(':sid', $sid, PDO::PARAM_STR);
            $this-&gt;sdb['read']['query']-&gt;execute();
            $this-&gt;sdb['read']['result'] = $this-&gt;sdb['read']['query']-&gt;fetch(PDO::FETCH_ASSOC);
        }
        catch( PDOException $exception ) {
            var_export($exception);

            return FALSE;
        }

        $this-&gt;sdb['read']['query']-&gt;closeCursor();

        return $this-&gt;sdb['read']['result']['data'];
    }

    function _write($sid, $data) {
        try {
            $this-&gt;sdb['write']['query'] = $this-&gt;sdb['conn']-&gt;prepare('REPLACE INTO sessions VALUES (:sid, :time, :data)');

            $this-&gt;sdb['write']['query']-&gt;bindParam(':sid', $sid, PDO::PARAM_STR);
            $this-&gt;sdb['write']['query']-&gt;bindParam(':time', date('Y-m-d H:i:s'));
            $this-&gt;sdb['write']['query']-&gt;bindParam(':data', $data, PDO::PARAM_STR);
            $this-&gt;sdb['write']['query']-&gt;execute();
        }
        catch( PDOException $exception ) {
            var_export($exception);

            return FALSE;
        }

        $this-&gt;sdb['write']['query']-&gt;closeCursor();

        return TRUE;
    }

    function _destroy($sid) {
        try {
            $this-&gt;sdb['destroy']['query'] = $this-&gt;sdb['conn']-&gt;prepare('DELETE FROM sessions WHERE id = :sid');

            $this-&gt;sdb['destroy']['query']-&gt;bindParam(':sid', $sid, PDO::PARAM_STR);
            $this-&gt;sdb['destroy']['query']-&gt;execute();
        }
        catch( PDOException $exception ) {
            var_export($exception);

            return FALSE;
        }

        $this-&gt;sdb['destroy']['query']-&gt;closeCursor();

        return TRUE;
    }

    function _clean() {
        try {
            $this-&gt;sdb['clean']['query'] = $this-&gt;sdb['conn']-&gt;prepare('DELETE FROM sessions WHERE access &lt; :stale');

            $this-&gt;sdb['clean']['query']-&gt;bindParam(':stale', date("Y-m-d H:i:s", strtotime("-30 minutes")));
            $this-&gt;sdb['clean']['query']-&gt;execute();
        }
        catch( PDOException $exception ) {
            var_export($exception);

            return FALSE;
        }

        $this-&gt;sdb['clean']['query']-&gt;closeCursor();

        return TRUE;
    }
}
It would be better to implement SessionHandlerInterface.
Your code is tightly coupled, move session_set_save_handler out from constructor to some bootstrap file. Also this class shouldn't create db connection, it is better to pass it as a constructor parameter:

$conn = new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME . ';charset=utf8', DBUSER, DBPASS);
$conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$handler = new MySessionHandler($conn);
session_set_save_handler($handler, true);


Constructor for the session handler:

class Session implements \SessionHandlerInterface
{
    protected $conn;

    public function __construct(\PDO $conn)
    {
        $this-&gt;conn = $conn;
    }

    // ....
}


This gives you more freedom, in case you decide to extend PDO you can pass it there. Also you don't need to create separate connection for application and session.
Implementing Interface ensures that you fulfill all requirements.

What I find odd is that you put every query to handler property, they should be local variables, you create them on every method call anyway.