Well after a couple of months ive figure out (on a win32 box at least) how to implement mod_auth_mysql

First the setup
apache 2.2.4
php 5.2.3
mysql 5.0.41

Now we need the auth module (i used DSO or .SO.. same thing)
head over to the XAMPP website and grab this file:
(thats the loose pack for their latest release that includes the mod_auth_mysql.so)

grab the file from the archive
and drop that into your current apache modules directory

Configuring Apache to use the module
-Edit your httpd.conf file and add this:
LoadModule mysql_auth_module modules/mod_auth_mysql.so
to the rest of your modules

-at the very bottom add this
<Directory “*****PATH*****”>
AuthName “MySQL Testing”
AuthType Basic
AuthMySQLHost localhost
AuthMySQLUser mod_auth
AuthMySQLPassword mod_auth
AuthMySQLDB mod_auth_mysql
AuthMySQLUserTable user_info
AuthMySQLNameField user_name
AuthMySQLPasswordField user_passwd
AuthMySQLPwEncryption md5
AuthMySQLEnable On
require valid-user

(make sure you replace the *****PATH***** to reflect the directory you are protecting)
(also you need to create this directory in your htdocs structure)

Configure mysql
-import this dump inside of a new database called mod_auth_mysql
CREATE TABLE `user_info` (
  `user_id` int(11) NOT NULL auto_increment,
  `user_name` char(30) collate utf8_unicode_ci NOT NULL,
  `user_passwd` varchar(32) collate utf8_unicode_ci NOT NULL,
  `user_group` char(10) collate utf8_unicode_ci default NULL,
  PRIMARY KEY  (`user_id`)

And that should work perfectly… hope that helps… feel free to post questions… il ltry to answer them

Comments are closed.

Post Navigation