WebHostGear.com - the hosting resource for professionalshosting tutorials 
hosting howto webhost guide server managementJuly 04, 2009
server management, apache tutorials, hosting tutorials, cpanel, server security
Home / Hosting Tutorials / cPanel Hosting / mod_auth_mysql Apache with cPanel

mod_auth_mysql Apache with cPanel



Printer Friendly Printer Friendly Send to a friend Send to a friend
By : ramprage Rating : Average Rating : 6.00 From 9 Voter(s)

mod_auth_mysql Apache with cPanel

Overview:
mod_auth_mysql is an Apache module that allows authentication using user and group data stored in MySQL databases. Originally by Vivek Khera for Apache1, now also includes a version for Apache 2.  Official SourceForge Project website http://sourceforge.net/projects/modauthmysql/

This tutorial will cover installing mod_auth_mysql on Apache for cPanel/WHM web servers. It was tested on Red Hat Enterprise with PHP 4.3.10 running Apache/1.3.33 with MySQL 4.0.20-standard using mod_auth_mysql-2.9.0

Installing mod_auth_mysql on Apache
The good news is that you don’t need to recompile Apache manually to install this addon! Simply follow the steps for an easy installation that takes about 15-25 minutes.

First off you’ll need to grab a copy of the latest mod_auth_mysql files
Download mod_auth_mysql-2.9.0.tar.gz

Now that you have the source file you will need to upload it to your web server. Connect to your server by FTP and upload the file to a directory; it doesn’t matter where it goes we’ll move it in a minute.



Article provided by WebHostGear.com

Now login as root to your server through SSH and go to the directory where you uploaded the file.  Move the file to another location.

mv mod_auth_mysql-2.9.0.tar.tar /usr/local/src/mod_auth_mysql-2.9.0.tar.tar

Extract the files contents

tar xvzf mod_auth_mysql-2.9.0.tar.tar
cd mod_auth_mysql-2.9.0.tar.tar

Open and read the BUILD and CONFIGURE documents for a general install understanding.

Now we’ll build the module file.

/usr/local/apache/bin/apxs -c -lmysqlclient -lm -lz -I /usr/include/mysql/ mod_auth_mysql.c

After building the module we will install it.

/usr/local/apache/bin/apxs -i mod_auth_mysql.so

Open up httpd.conf with your favourite editor, we need to add two lines to the configuration.

pico /usr/local/apache/conf/httpd.conf
Search for the .so files and add this below them.
ctrl + w
and type in .so, press enter. You should see this with a list of modules

# Example
# LoadModule foo_module libexec/mod_foo.so

Scroll down to the last .so module listed and enter a new line.

LoadModule mysql_auth_module libexec/mod_auth_mysql.so

We need to add a second line to the httpd.conf so lets do another search.
Search for the AddModule files and add this below them.
ctrl + w
and type in AddModule, press enter. You should see this with a list of files with a .c extension. Scroll to the bottom of the list and add the following. THE ORDER OF ADDING THIS IS IMPORTANT PLEASE SEE OUR FORUM POST FOR INSTRUCTIONS http://www.webhostgear.com/forums/showthread.php?p=1648

AddModule mod_auth_mysql.c

Save your Apache configuration changes.
ctrl + x then press Y

Now mod_auth_mysql has been installed but you want to test your Apache configuration first to ensure everything is ok! Run the apachectl configtest. The configtest will not affect your live server, so starting and stopping the configtest won’t stop and start your websites.

apachectl configtest start

You should see a message that says Syntax OK. This means Apache is ready to go.

Restart the live Apache server
/etc/init.d/httpd restart

You can see your new module in phpinfo(); pages, in the apache heading, you should see.

Loaded Modules  mod_auth_mysql

You have successfully setup mod_auth_mysql on Apache.

THE ORDER OF ADDING THIS IS IMPORTANT PLEASE SEE OUR FORUM POST FOR INSTRUCTIONS
http://www.webhostgear.com/forums/showthread.php?p=1648

About the Author:
Steven Leggett is the editor of the server resource and hosting tutorial site, www.webhostgear.com

New! - Need server help? Hire an Expert

Get professional help with your configuration, script installation or server issue.
Learn how we can help you with any server problem and make your server run like new. Professional staff will contact you, after submitting a quote request, by phone or email.

Rate this Article :

1

2

3

4

5

6

7

8

9

10
Poor Excellent

Related Articles


» Common SSH Commands - Linux Shell Commands
» How to install mod_security for Apache
» Server Loads Explained
» Installing DrWEB server antivirus for Linux CPanel
» Apache Log Files Explained
» How to install ionCube loader
» Howto mod_rewrite with Apache
» Installing mod_bandwidth For the Ultimate in Apache Utilization Control
» Installing Mod_Throttle on cPanel


Discuss this article with others in our new hosting forums

Comments / Feedback

Stilgherrian
Thanks for a clear and easy-to-follow procedure. I can confirm that it takes 25 minutes from a standing start.

But... there's a problem.

With mod_auth_mysql installed, all password-procted VirtualHosts started trying to use MySQL authentication, even those that are supposed to be using flat htpasswd files!

Others have reported this problem too: see http://forum.ev1servers.net/showthread.php?t=55147 for an example.

Suggestions?

Does Apache have to be rebuilt from source too?

WHM 10.1.0 cPanel 10.2.0-S73, Apache 1.3.33, mod_auth_mysql 2.9.0.
Stilgherrian
The answer can be found here:

http://forum.agileco.com/archive/index.php/t-763.html

In brief, you need to turn off MySQL authentication server-wide, and then turn it back on for the directories you want. In your httpd.conf file, change the access controls thusly:


Options All
AuthMySQLEnable off
AllowOverride All


Then, in the specific directories, add:

AuthMySQLEnable on

And restart httpd, of course.
maggie
You can just add

AuthMySQLAuthoritative Off

to the regular htaccess file that points to the flat htpasswd
Ritesh
When I perform search,



--------------------------

[ "AddModule files" not found ]

--------------------------

How to go ahead now?

ritesh
Hello,

When Searched for

AddModule files in

apache conf file it say

[ "/apache/conf/php.con" not found]

How to go about?
Can you please guide me.
Mahdi
does it work on cpanel / whm 11.x
and there are any version of this mod to i can using it in whm

 Add Comment
Name
Email
Image Code
Refresh Image

Comments / Feedback



Our site offers free hosting tutorials, cpanel tutorial, web hosting news, shell commands, running a web hosting business, dedicated guides, linux tutorial, apache install, home web server, web server guide, ssh commands, dedicated servers, DNS nameservers, chkrootkit, apf firewall, exim configuration, server compromised, cron backup solution, ftp backup script

Server Tutorials


WebHostGear Reviewed by Ping Zine - Click here

Links:
Lunarpages Coupon