mod_auth_mysql Apache with cPanel Published: Mar 23, 2005
  • Rating

    0/5

mod_auth_mysql is an Apache module that allows authentication using user and group data stored in MySQL databases. We'll guide you through installing modauthmysql on Apache with Cpanel/WHM.

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.

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

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

  • Rating

    0/5

Related Articles

Comments (7)

  • Gravatar - Stilgherrian
    Stilgherrian 12:55, May 8, 2005
    Thanks for a clear and easy-to-follow procedure. I can confirm that it takes 25 minutes from a standing start.<br />
    <br />
    But... there's a problem.<br />
    <br />
    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!<br />
    <br />
    Others have reported this problem too: see http://forum.ev1servers.net/showthread.php?t=55147 for an example.<br />
    <br />
    Suggestions?<br />
    <br />
    Does Apache have to be rebuilt from source too?<br />
    <br />
    WHM 10.1.0 cPanel 10.2.0-S73, Apache 1.3.33, mod_auth_mysql 2.9.0.
  • Gravatar - Stilgherrian
    Stilgherrian 04:07, May 12, 2005
    The answer can be found here:<br />
    <br />
    http://forum.agileco.com/archive/index.php/t-763.html<br />
    <br />
    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:<br />
    <br />
    <Directory /><br />
    Options All<br />
    AuthMySQLEnable off<br />
    AllowOverride All<br />
    </Directory><br />
    <br />
    Then, in the specific directories, add:<br />
    <br />
    AuthMySQLEnable on<br />
    <br />
    And restart httpd, of course.
  • Gravatar - maggie
    maggie 01:18, October 15, 2006
    You can just add<br />
    <br />
    AuthMySQLAuthoritative Off<br />
    <br />
    to the regular htaccess file that points to the flat htpasswd
  • Gravatar - Ritesh
    Ritesh 13:20, January 23, 2008
    When I perform search,<br />
    <br />
    <AddModule files><br />
    <br />
    --------------------------<br />
    <br />
    [ "AddModule files" not found ]<br />
    <br />
    --------------------------<br />
    <br />
    How to go ahead now?<br />
    <br />
  • Gravatar - ritesh
    ritesh 13:31, January 23, 2008
    Hello,<br />
    <br />
    When Searched for <br />
    <br />
    AddModule files in <br />
    <br />
    apache conf file it say<br />
    <br />
    [ "/apache/conf/php.con" not found]<br />
    <br />
    How to go about?<br />
    Can you please guide me.
  • Gravatar - Mahdi
    Mahdi 12:01, February 2, 2008
    does it work on cpanel / whm 11.x<br />
    and there are any version of this mod to i can using it in whm
  • Gravatar - ZDwedaypaw
    ZDwedaypaw 18:49, May 23, 2011
    torebki skórzane david jones torebki torebki listonoszki torebki kazar
    <a href="http://torebki4you.com">torebki kazar</a> torebki online torebki skórzane
    torebki online tanie torebki kazar torebki torebka kuferek torebki listonoszki
    torebki damskie torebki kazar [url=http://torebki4you.com]tanie torebki [/url]

Add Your Thoughts

WebHostGear.com is a hosting directory, not a web host.

Copyright © 1998-2017 WebHostGear.com