The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Apache::Session::MariaDB - An implementation of Apache::Session using MariaDB


 use Apache::Session::MariaDB;

 #if you want Apache::Session to open new DB handles:

 tie %hash, 'Apache::Session::MariaDB', $id, {
    DataSource => 'dbi:MariaDB:sessions',
    UserName   => $db_user,
    Password   => $db_pass,
    LockDataSource => 'dbi:MariaDB:sessions',
    LockUserName   => $db_user,
    LockPassword   => $db_pass

 #or, if your handles are already opened:

 tie %hash, 'Apache::Session::MariaDB', $id, {
    Handle     => $dbh,
    LockHandle => $dbh


This module is an implementation of Apache::Session. It uses the MariaDB backing store and the MariaDB locking scheme. See the example, and the documentation for Apache::Session::Store::MariaDB and Apache::Session::Lock::MariaDB for more details.

It's based on Apache::Session::MySQL but uses DBD::MariaDB instead of DBD::mysql. The initial reason to create this new module is that DBD::MariaDB requires to explicitly indicate a_session column as binary in DBI's bind_param calls, which is different from DBD::mysql and thus Apache::Session::MySQL doesn't support it.


Best Practical Solutions, LLC <>

Jeffrey William Baker <>

Tomas Doran <<gt>


Copyright (C) 2024, Best Practical Solutions LLC.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Apache::Session::MySQL, Apache::Session::File, Apache::Session::Flex, Apache::Session::DB_File, Apache::Session::Postgres, Apache::Session