PDA

View Full Version : Apache + mysql



gibz85
30th July 2008, 10:36 AM
Hello..

Can anyone tell me how to link mysql and Apache together...

Will it be done by default installation... or should i change something in httpd.conf ...

or any diff module is needed for it to work..... Really new to mysql + apache

markkuk
30th July 2008, 11:14 AM
The apache DBD module is part of standard installation, and you can write your own modules using the provided API (http://httpd.apache.org/docs/2.2/mod/mod_dbd.html).
Is that what you actually want? Normally MySQL (or other databases) isn't used directly from apache httpd, but from server-side scripting languages like PHP or Perl. Then you need to install the suitable connecting module for your language/database combination, e.g. php-mysql or perl-DBD-MySQL.

gibz85
30th July 2008, 11:32 AM
As i said i have no idea how to link Apache and mysql together.... It will be really helpfull if you could provid a basic idea about the working of mysql and apache together.... Or if you know and nice link to this subject it will be really helpfull

markkuk
30th July 2008, 11:40 AM
As i said i have no idea how to link Apache and mysql together.
In that case, first you need to think what you really want to do. What's the purpose of your desire to "link Apache and mysql together"? What's the result you want to gain from that combination?

oneofmany
30th July 2008, 11:41 AM
As markkuk said. :)

Are you trying to do user authentication to a mysql database? if so, you want to make sure apache is loading mod_auth_mysql, which I believe it does my default.

once the module is loaded, it will provide you with new .conf file options. Below is an example ..



<directory "/var/www/html/secure/">
Auth_MySQL_Info localhost db_user db_password
Auth_MySQL_DB dummy
Auth_MySQL_Password_Table users
Auth_MySQL_Username_Field userid
Auth_MySQL_Password_Field passwd

AuthType Basic
AuthName "Members Only"

Require valid-user
</directory>



The example above assumes that ..

* the folder you are protecting on your website is /secure
* the folder is located on the server at /var/www/html/secure
* Your database is on the same machine as apache (localhost)
* Your database login is db_user with password db_password
* Your database is called dummy
* your password table is called user
* your password table contains fields userid and passwd
* your password field contains an encrypted password

gibz85
30th July 2008, 12:45 PM
Nice, awesome guys... I gotta go... I will update as i come back.... Again thanks for the help,,

gibz85
1st August 2008, 05:54 AM
yaar i figured it out... Thanks for your help.....