1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
Database Session Handler
------------------------
1) Introduction
New with 0.53 is the ability to store PHP session information in the
database.
2) Configuration
New include/config.php variables available:
$CONFIG_VARS['session_handler.enable'] = TRUE;
$CONFIG_VARS['session_handler.session_table'] = "php_session";
$CONFIG_VARS['session_handler.host'] = "localhost";
$CONFIG_VARS['session_handler.dbname'] = "opendb";
$CONFIG_VARS['session_handler.username'] = "lender";
$CONFIG_VARS['session_handler.passwd'] = "test";
$CONFIG_VARS['session_handler.debug-sql'] = FALSE;
The 'table_prefix' is not supported, so if you require the 'session_table'
to have a prefix, include it in the $CONFIG_VARS['session_handler.session_table']
value you configure.
These variables allow you to override the default database information,
so that the session table can be stored in a dedicated database, and on
another host if required.
Any that are not defined will be replaced with the $db_server array
value with the same index suffix (After the 'db_server.' prefix)
3) Setup
First of all, ensure that you have $CONFIG_VARS['session_handler.???????']
variables defined for 'session_table', 'host', 'dbname', 'username', 'passwd',
or as many of these as required, where different from
$CONFIG_VARS['db_server.?????'].
Make sure that the include/config.php variable
$CONFIG_VARS['session_handler.enable'] = TRUE;
Now open the 'patch.php' and choose the 'Database Session Handler'
option. This step is required to install the php session table into
your database. Without it, the session handler will not work and
you will not be able to login in.
Click on the 'Add ????? Table', where ????? is the uppercase version
of the $CONFIG_VARS['session_handler.session_table'] (or 'php_session' if not
defined) you configured, or PHP_SESSION if not defined.
4) Issues
When you install the new session_handler, all active sessions stored against
the default PHP session handler will be lost.
When you set the $CONFIG_VARS['session_handler.enable'] = TRUE all login access
to OpenDb will be disabled until the session_handler.table table is created.
Earlier versions of PHP did not provide access to the 'session.save_handler',
via ini_set("session.save_handler", "user"). In this case, either you will
have to set the 'session.save_handler' to 'user' in the php.ini file directly,
or you will have to continue to use file based session management.
A OpenDb log entry will be made if the 'user' handler cannot be used, because
the ini_set("session.save_handler", "user") command failed. In this case
to avoid the log, you should probably disable $session_handler['enable'],
or directly modify php.ini directly.
|