Friday 5 September 2014

Apache Authentication using MySql Database


Hello guys! welcome back for another interesting feature of Apache2.
Many time you face a problem while while assigning a rights to a user to access particular directory, till date many developer are facing problem while creating new user and assigning the rights to them, because they always have to make changes in apache .htaccess file in directory which they wan't to allow to user to view.
Developer also has to manually create a password for individual user using htpasswd, Now assume there are 10,000 user and it is increase by 100 everyday, so this become very tedious and it may cause error or what if someone delete your .htaccess file.
There is always following question in mind
  • How can we make it automatic ?
  • Can i use my existing customer table to do this ?
  • How can i connect to DB ?

So let's have a look how can we make this possible.

Follow the below step
  1. Install :
    sudo apt-get install apache2
  2. Download following files
    auth_mysql.load
    mod_auth_mysql.so