mod_auth_mysql problem

Problems with the Linux version of XAMPP, questions, comments, and anything related.

mod_auth_mysql problem

Postby sibawe » 07. January 2007 00:57

Hello,

I'm new here, sorry if this question is obvious...

How do I install mod_auth_mysql ?

The module is packed in the last WINDOWS version but apparently not in the last LINUX version, available in the xampp-linux-1.5.5a.tar.gz.

The library is nowhere to be found in /opt/lampp/modules, or in any other directory in /opt/lampp for that matter.

I doubt that it needs to be compiled from scratch.

Thanks for your answers.
sibawe
 
Posts: 4
Joined: 07. January 2007 00:32

Postby sibawe » 08. January 2007 19:29

Hi everyone,

Some tinkering was needed to find the solution, here it is.
It works for my configuration, hopefully it will work for others too :D

FYI, I installed xampp-linux1.5.5a., on Fedora4, in the default directory (/opt/lampp)

Login as root (linux commands are preceded by "root>", mysql commands are preceded by "mysql_root>", comments are preceded by "#") , stop all lampp processes.

1/ To install extra modules, you need to install the xampp-linux-devel package => download "xampp-linux-devel-1.5.5a.tar.gz "

2/ root> tar xzvf xampp-linux-devel-1.5.5a.tar.gz -C /opt #to untar in /opt/lampp
This adds the extra libraries you'll need. If you don't do it, you'll have errors while running apxs

3/ fetch the latest source code of mod_auth_mysql at http://modauthmysql.sourceforge.net/

4/ In my case, I needed to patch the .c file (!!??) for mod_auth_mysql-3.0.0 , since I was getting compile syntax errors involving "mysql_auth_config_rec". Information at this site was sufficient: http://www.bleb.org/software/mod_auth_mysql-3.0.0-apache-2.2.3.patch. My patched file is here:http://community.apachefriends.org/f/viewtopic.php?t=22381

5/ Next, install the module. For LAMPP, you'll need to tell the compiler where to find libmysqlclient.so and mysql.h with the following compile directives :"-L" and "-I" =>
root> /opt/lampp/bin/apxs -c -L/opt/lampp/lib/mysql -I/opt/lampp/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c
# to generate the module

6/ Next, install the object file in the /opt/lampp/modules directory:
root>apxs -i mod_auth_mysql.la #to install in modules/
you can check that the library is installed by checking the presence of /opt/lampp/modules/mod_auth_mysql.so

7/ Modify your /opt/lampp/etc/httpd.conf by adding the following line in the "Dynamic Shared Object (DSO) Support" section:
LoadModule mysql_auth_module modules/mod_auth_mysql.so

8/ Create the appropriate database in Mysql. Here is an example:
root> mysql -h localhost -u root -p******
mysql_root>create database auth;
mysql_root>create table authorised_users(name varchar(30) primary key,password varchar(50)); # make sure password is big enough to contain sha1 passwords
mysql_root>insert into table authorised_users(name,password) values ('user', sha1('pass')); # I use sha1 passwords
mysql_root>grant all privileges on auth.* to webauth identified by 'webauth'; # create user webauth/webauth to access the database and check the user information

9/ Create the directory that you want to protect:
root>mkdir /opt/lampp/htdocs/secure
add an index.html file in this directory

10/ Create into this directory an .htaccess file with the following:
#this prevents this error : Error 500 The server encountered an internal error or misconfiguration and was unable to complete your request
# in /opt/lampp/logs/error_log : [error] Internal error: pcfg_openfile()
# details at https://secure-support.novell.com/Kanis ... ublic.html

AuthBasicAuthoritative Off

# Define Authorisation type

AuthName "MySQL Testing"
AuthType Basic

# Info needed to connect to the database:

AuthMySQLHost localhost
AuthMySQLDB auth
AuthMySQLUser webauth
AuthMySQLPassword webauth
AuthMySQLUserTable authorised_users
AuthMySQLNameField name
AuthMySQLPasswordField password
AuthMySQLPwEncryption sha1
AuthMySQLEnable On

# IMPORTANT:

require valid-user


11/ Try to connect to : http://localhost/secure/index.html, it should work ... , it does for me

Good luck
sibawe
 
Posts: 4
Joined: 07. January 2007 00:32


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 2 guests