December 2007
Beginner to intermediate
310 pages
8h 8m
English
You wish to use user and password information in your MySQL database for authenticating users.
For Apache 1.3, use mod_auth_mysql:
Auth_MySQL_Info db_host.example.com db_user my_password
Auth_MySQL_General_DB auth_database_name
<Directory /www/htdocs/private>
AuthName "Protected directory"
AuthType Basic
require valid-user
</Directory>For Apache 2.2 and later, use mod_authn_dbi:
AuthnDbiDriver Config1 mysql AuthnDbiHost Config1 db.example.com AuthnDbiUsername Config1 db_username AuthnDbiPassword Config1 db_password AuthnDbiName Config1 auth_database_name AuthnDbiTable Config1 auth_database_table AuthnDbiUsernameField Config1 user_field AuthnDbiPasswordField Config1 password_field AuthnDbiIsActiveField Config1 is_active_field AuthnDbiConnMin Config1 3 AuthnDbiConnSoftMax Config1 12 AuthnDbiConnHardMax Config1 20 AuthnDbiConnTTL Config1 600 <Directory "/www/htdocs/private"> AuthType Digest AuthName "Protected directory> AuthBasicProvider dbi AuthnDbiServerConfig Config1 Require valid-user </Directory>
There are a number of modules called mod_auth_mysql. The module used in the previous example is the mod_auth_mysql from http://www.diegonet.com/support/mod_auth_mysql.shtml. For the full explanation of the database fields that you will need to create, and the additional options that the module affords, you should consult the documentation on the Web site.
If you are running Apache 2.2 or later, you will want to take ...
Read now
Unlock full access