Apache/PHP GDBM 失败,处理程序的驱动程序初始化失败:gdbm

Apache/PHP GDBM failing with Driver initialization failed for handler: gdbm

我有一个系统使用 PHP 构建了一个 GDBM 文件,然后 Apache 引用该文件来执行基本身份验证。自 1999 年以来一直 运行ning 有许多版本的 apache 和 PHP 直到现在我正在进行升级以符合公司政策。

如果我从命令行 运行 php(指定适当的 php.ini 文件),那么 DBA 功能可以正常工作。

然而,当它从 Apache 内部调用时,它从 PHP 调用 dba_open(...) 我得到:

Warning: dba_open(/etc/httpd/conf/users.tmp,n): Driver initialization failed for handler: gdbm: File open error in /var/www/phpinc/bxxx.inc

PHP 是使用以下命令构建的:

./configure --with-iconv --with-mysql --with-mysql-sock=/var/run/mysql/mysql.sock --with-apxs2=/usr/local/apache2/bin/apxs --with-gdbm --enable-mbstring --with-gd --enable-dba

我只是根据其他一些评论添加了 --enable-dba。

gdbm_dump 失败并报告:

gdbm_dump: gdbm_open failed: Unexpected end of file

但现在已经设法使用命令行重建 GDBM 数据文件 PHP 它工作正常 - 因此似乎可能存在(或曾经存在)字符编码问题或类似问题

在 apache 内部它失败了:

 [authn_dbm:error] [pid 14104:tid 140279619360512] (20014)Internal error (specific information not available): [client 10.160.9.247:52710] AH01754: could not open dbm (type GDBM) auth file: /etc/httpd/conf/users, referer: xxxxx

我假设它必须与机器上的库不匹配有关,但我想不出更多的调试方法。任何帮助或建议将不胜感激。

好的。排序!

首先我下载了​​ gdbm 源和 built/installed 它。

然后我在 PHP 和 Apache 配置行中添加了显式 --with-gdbm=/usr/src/gdbm-1.11。

然后我注意到新的 gdbm 已自行安装 /usr/local/lib 但这不在我 ld.so.conf 的搜索路径中。所以我复制了文件并在 /usr/lib64.

中创建了正确的链接(.so.4 等)

最后,我在命令行中使用它的问题与权限相关——因为从命令行创建了一个版本,它不再具有在 apache 中打开所需的 apache 所有权。对于那些遵循您在 dba_open() 中看到的特定错误的人是:

dba_open(...): Driver initialization failed for handler: gdbm: File open error

除了所有其他 "dll hell" 把东西扔掉之外,这当然会很有帮助。

反正最后解游戏从用ldd来看:

/usr/local/bin/php
/usr/local/apache2/bin/httpd
/usr/local/apache2/lib/libapr-1.so.0
/usr/local/apache2/lib/libaprutil-1.so.0
/usr/local/apache2/modules/libphp5.so

一旦我看到他们正在链接到不同版本的 libgdbm,一切就开始自行解决了。