【问题标题】:Apache authentication using MySQL via mod_authn_dbd fails通过 mod_authn_dbd 使用 MySQL 的 Apache 身份验证失败
【发布时间】:2013-08-20 11:20:59
【问题描述】:

我正在尝试使用存储在 mysql 数据库中的 user:password 的基本身份验证来限制对目录的访问。在启用 mod_authn_dbd 的情况下启动 Apache 服务后,它会创建大约 60 到 70 个 MySQL 进程,所有这些进程都有一个“睡眠”命令。然而,这些错误会出现在整个 Apache 日志中,并且由于此错误,身份验证会间歇性地失败:

[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

我尝试调整 MySQL 连接限制和 DBD 参数来解决这个问题,但没有成功。

这是我当前的配置,已删除敏感信息:

<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>

【问题讨论】:

    标签: mysql apache basic-authentication


    【解决方案1】:

    您好像遇到了Bug #45995 mod_authn_dbd conflict with php+mysql

    related post 中所述,这是由 apache apr-util mysql 驱动程序和 php mysql 驱动程序之间的冲突引起的。如果你不使用php-mysql,你可以卸载它,或者如果你使用它,你可以将apr和apr-util降级到1.3或以下版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-27
      • 2022-08-11
      • 2017-07-24
      • 2018-11-02
      相关资源
      最近更新 更多