简体   繁体   English

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

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

I have a system that has used PHP to build a GDBM file that is then referenced by Apache to perform basic authentication. 我有一个使用PHP构建GDBM文件的系统,然后Apache引用该文件执行基本身份验证。 It has been running since 1999 with many versions of apache and PHP until now when I am doing an upgrade to match corporate policy. 自1999年以来,它就已经运行了许多版本的apache和PHP,直到现在我正在进行升级以匹配公司策略。

If I run php from the command line (specifying the appropriate php.ini file) then the DBA functionality works correctly. 如果我从命令行运行php(指定适当的php.ini文件),则DBA功能可以正常工作。

However when it is called from within Apache at the point it calls dba_open(...) from PHP I get: 但是,当从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 was built with the following command: 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

And I only added the --enable-dba based on some other comments. 我只是基于其他注释添加了--enable-dba。

gdbm_dump was failing and reporting: gdbm_dump失败并报告:

gdbm_dump: gdbm_open failed: Unexpected end of file

but now having managed to rebuild the GDBM datafile using command-line PHP it works correctly - hence it seems there might be (or was) a character encoding issues or something similar 但现在设法使用命令行PHP重建了GDBM数据文件,它可以正常工作-因此,似乎可能存在(或曾经存在)字符编码问题或类似问题

Inside apache it fails with: 在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

I am assuming it has to be something to do with a library mismatch on the machine a but I can't think of any more ways to debug it. 我认为这一定与机器a上的库不匹配有关,但我想不出其他任何方法对其进行调试。 Any help or suggestions would be much appreciated. 任何帮助或建议,将不胜感激。

OK. 好。 sorted! 排序!

Firstly I downloaded the gdbm source and built/installed it. 首先,我下载了gdbm源并构建/安装了它。

Then I added to PHP and Apache configure lines an explicit --with-gdbm=/usr/src/gdbm-1.11. 然后,我向PHP和Apache配置行添加了一个明确的--with-gdbm = / usr / src / gdbm-1.11。

Then I noticed that the new gdbm had installed itself /usr/local/lib but this was not in my search path in ld.so.conf. 然后,我注意到新的gdbm已经安装了自身/ usr / local / lib,但这不在ld.so.conf中的搜索路径中。 So I copied the files and created the correct links (.so.4, etc) in /usr/lib64. 因此,我复制了文件并在/ usr / lib64中创建了正确的链接(.so.4等)。

Finally my issue with it working from the command line was permission related - since having created a version from the command line it no longer had the apache ownership required to open inside apache. 最后,我在命令行中使用它的问题是与权限相关的-由于从命令行创建了一个版本,因此它不再具有在apache中打开所需的apache所有权。 For those who follow the specific error you see for dba_open() is: 对于那些遵循特定错误的人,您看到的dba_open()是:

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

which of course would have been quite helpful apart from all the other "dll hell" throwing things off the trail. 除了将所有其他“ dll地狱”扔掉之外,哪一个当然会很有帮助。

Anyway in the end the solution game from using ldd to look at: 无论如何,最后的解决方案游戏是使用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

Once I could see they were linking to different version of libgdbm it all started to sort itself out. 一旦看到它们链接到libgdbm的不同版本,所有这些都开始整理出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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