Keep Server Online|
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Apache Lounge is not sponsored.
Your donations will help to keep this site alive and well, and continuing building binaries.
Joined: 07 Jan 2016
|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.
|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;
DBDParams "host=127.0.0.1 port=3306 dbname=session_db user=apache pass=dhishkhk"
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
Options -Indexes +FollowSymLinks
AuthName "My Login"
ErrorDocument 401 /login.php
SessionDBDCookieName session path=/;
ExpiresByType application/x-java-jnlp-file "now"
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!!