php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13358 Berkeley DB3 and the DBA functions
Submitted: 2001-09-18 02:28 UTC Modified: 2002-01-12 02:31 UTC
From: mark at neaturl dot com Assigned:
Status: Closed Package: DBM/DBA related
PHP Version: 4.0.6 OS: RedHat 7.1
Private report: No CVE-ID: None
 [2001-09-18 02:28 UTC] mark at neaturl dot com
I have noticed that a similar bug has been reported (Bug id #11732) - however I can report more details and I have another script with interesting results.

First: the code that was provided in #11732

[code]
<?php
if(!$fp = dba_open("test.db", "c", "db3")) {
        print("error");
        exit;
}
dba_insert("testkey", "testval", $fp);
echo( dba_fetch("testkey", $fp));
dba_close($fp);
?>

[/code]
[output]
Warning: driver initialization failed in /usr/local/apache/htdocs/www-root/neaturl.com/temp/test.php on line 3
error
[/output]
But get this - test.db is created!

The above code was called through from my browser (thus through the Apache web server)

Here is a link to a snapshot of my php config at the time I ran that code:

http://neaturl.com/temp/phpinfo-0109181613.html


Now - here is the twist! If I call the same script (adding the path to the php binary) from bash, it runs fine!

[code]
#!/usr/local/bin/php
<?php

if(!$fp = dba_open("test.db", "c", "db3")) { 
        print("error"); 
        exit; 
} 
dba_insert("testkey", "testval", $fp); 
echo( dba_fetch("testkey", $fp)); 
dba_close($fp); 
?>
[/code]
[output]
X-Powered-By: PHP/4.0.6
Content-type: text/html

testval
[/output]

Actually, I came accross this problem because I had written a php script to initialize the postfix/virtual.db (which I ran from bash and had written a php script to read and output the key:value pairs (which again I ran OK from bash). But when I tried to run the same script by calling it from my browser - no cigar!

Now I am assuming this is a bug. I would be delighted to learn that perhaps I have missed configuring something in php.ini

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-18 02:33 UTC] mark at neaturl dot com
Um. yeah, I am using BerkeleyDB3.1.17 which came rpm installed as part of the standard install.
 [2001-09-21 13:32 UTC] mark at neaturl dot com
Just a couple of more points of information:

1) I have now tried compiling libphp4.so every which way. I have downloaded and installed from source db3.1.17, db3.2.9 and db3.3.11 - and have tried configuring --with-db3= (path to db3) with each of these different versions. No luck.

2) Again, I have no problem using the db3 driver and the dba functions with the stand alone binary of php that I configured --with-db3 Permissions are not a problem.

3) That link I gave to the phpinfo snapshot is gone. I am a dangerous sysadmin when logged in as root! But the dynamicly generated phpinfo() page is http://neaturl.com/phpinfo.php

I've gone crazy over this. The only solutions I can see is to run the scripts that use dba functions on my db3 file as CGI.
 [2002-01-12 02:29 UTC] swm@php.net
Fixed in current CVS.
 [2002-01-12 02:31 UTC] swm@php.net
closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 07:01:30 2024 UTC