Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: mod_session_dbd failed to store session to DB session table |
|
Author |
|
alexqian
Joined: 07 Jan 2016 Posts: 7 Location: U.S.A
|
Posted: Wed 13 Jan '16 1:21 Post subject: mod_session_dbd failed to store session to DB session table |
|
|
I am upgrading apache mod_auth_form from 2.0.5 to 2.4. having trouble configuring mod_session_dbd. Need HELP!!
My configuration for httpd.conf - that fails to redirect to the protected main/main.php page even after the user is authenticated by login.php.
Code: | CREATE TABLE `session` (
`id` bigint unsigned NOT NULL auto_increment,
`value` varchar(512) NOT NULL DEFAULT '',
`expiry` bigint unsigned NOT NULL DEFAULT 0,
`key` varchar(256) NOT NULL DEFAULT '',
primary key (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DBDriver mysql
DBDParams "host=127.0.0.1 port=3306 dbname=session_db user=apache pass=dhishkhk"
DBDMin 4
DBDKeep 8
DBDMax 20
DBDExptime 300
DBDPrepareSQL "select value from session where `key` = %s and (expiry = 0 or expiry > %lld)" selectsession
DBDPrepareSQL "delete from session where `key` = %s" deletesession
DBDPrepareSQL "insert into session (value, expiry, `key`) values (%s, %lld, %s)" insertsession
DBDPrepareSQL "update session set value = %s, expiry = %lld, `key` = %s where `key` = %s" updatesession
<Directory "/var/www/html/main">
Options -Indexes +FollowSymLinks
SSLRequireSSL
SetHandler form-login-handler
AuthFormLoginRequiredLocation /login.php
AuthFormLoginSuccessLocation /main/main.php
AuthFormProvider dbd
AuthFormUsername uid
AuthFormPassword password
AuthType form
AuthName "My Login"
ErrorDocument 401 /login.php
Session On
#SessionDBDPerUser On
SessionDBDCookieName session path=/;
SessionDBDSelectLabel selectsession
SessionDBDDeleteLabel deletesession
SessionDBDInsertLabel insertsession
SessionDBDUpdateLabel updatesession
SessionDBDCookieRemove Off
Require valid-user
ExpiresActive On
ExpiresByType application/x-java-jnlp-file "now"
</Directory> |
We write our custom login.php script that is invoked when client first accesses the main page. The script shows a login HTML form, then takes user input (uid and password) to authenticate against SQL user DB as well as LDAP user accounts. Once the uid/password is authenticated, it appears that mod_session is able to set "session" cookie, but is unable to store the session to the "session" table I created. I expect that mod_session_dbd is going to match the "session" in the cookie with the info in the session DB table (via the selectsession DBDPrepareSQL) and see the user is already autenticated, and let it go to main page, instead of login.php again as if it were not authenticated (which is what happens with my configuration above).
The apache documentation for mod_session_dbd is minimal and incomplete, and I have not been able to find any working example of mod_session_dbd anywhere on the web that I can use for reference. Don'e even know how to debug mod_session_dbd... Struggling with this for 6 days now, any help/suggestion would be much appreciated!! |
|
Back to top |
|
|
|
|
|
|