简体   繁体   中英

Apache authentication using MySQL via mod_authn_dbd fails

I am attempting to limit access to a directory using basic authentication with the user:password stored in a mysql database. Upon starting the Apache service with mod_authn_dbd enabled it creates about 60 to 70 MySQL processes, all of them have a command of "sleep". These errors however appear throughout the Apache log, and as a result of this error the authentication intermittently fails:

[Mon Aug 19 21:38:15 2013] [error] (20014)Internal error: DBD: failed to initialise
[Mon Aug 19 21:38:15 2013] [crit] (20014)Internal error: DBD: child init failed!
[Mon Aug 19 21:38:15 2013] [error] (20014)Internal error: DBD: Can't connect to mysql

I have tried adjusting MySQL connection limits and the DBD Parameters to fix this, without success.

This is my current configuration, with sensitive info removed:

<IfModule mod_authn_dbd.c>
  DBDriver mysql
  DBDParams "host=localhost port=3306 dbname=SITE_USERS user=DBUSER pass=DBPASS"
  DBDExptime 300
  DBDMin 1
  DBDMax 10
</IfModule>

<Directory "/home/mysite/public_html/protected">
  AuthCookieName CookieAuth
  AuthCookieBase64 On
  AuthType Basic
  AuthName "Registered User"
  AuthBasicProvider dbd
  AuthDBDUserPWQuery "SELECT password FROM users WHERE username = %s"
  Require valid-user
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

It seems like you're running into Bug #45995 mod_authn_dbd conflict with php+mysql .

As described in a related post , this is caused by a conflict between apache apr-util mysql driver and php mysql driver. You can either uninstall php-mysql if you are not using it, or if you are, you can downgrade apr and apr-util to version 1.3 or below.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM