ID: 25794 Comment by: sam at readinga-z dot com Reported By: rcovell at rolet dot com Status: Assigned Bug Type: DBM/DBA related Operating System: FreeBSD 4.8 PHP Version: 4.3.4RC1 Assigned To: helly New Comment:
We can confirm this bug. We are having the same problem using db3 files created with Apache dbmmanage. Apache can not read db3 files created by PHP and PHP can not read the files created by dbmmanage. Using db3_dump reveals that the dbmmanage files are of type 'hash' and that the PHP files are of type 'btree'. We had a similar issue with version 4.1.2 (which we are trying to upgrade from) where dbmmanage/Apache could not read the files created by PHP, but PHP can read the files created by dbmmanage. Our error: PHP Warning: dba_open(/var/www/db/razdb/razpassdb,w): Driver initialization failed for handler: db3: Invalid argument in /var/www/html/old_raz/razphp/admin/ ADMIN_userrset.php on line 130 Unworking configuration is Apache 2, PHP 4.3.4 on x86 RedHat 7.3 and 7.1 Previous Comments: ------------------------------------------------------------------------ [2003-10-08 10:10:39] rcovell at rolet dot com Description: ------------ Basically I cannot get php to open an existing (not created by php) db3 hash file when using either "w" or "c". It seems that php is looking for a btree format. My database is a hash file. More information: Trying to read/write information to an existing db3 database (sendmail aliases file). I can read the file just fine. But when I try to issue: $id = dba_open ("aliases5.db", "w", "db3"); I get: [Wed Oct 8 08:56:44 2003] [error] PHP Warning: dba_open(aliases5.db,w): Driver initialization failed for handler: db3: Invalid argument in /usr/local/www/data/maillists/test3.php on line 3 After further testing I dumped the entire aliases db to a text file using perl and recreated a copy of it with php: $id = dba_open ("aliases5.db", "c", "db3"); This worked when creating a new file. The file sizes where were different from the original so performed a db3_dump on the newly created php db3 database. It seems that php is defaulting to a btree format when trying to open with either w or c. My output from the db3_dump on the php created db3: VERSION=3 format=bytevalue type=btree HEADER=END And from the one that sendmail created: VERSION=3 format=bytevalue type=hash h_nelem=172 HEADER=END Reproduce code: --------------- //Note you need a hash database for this to fail $id = dba_open ("aliases5.db", "w", "db3"); if (!$id) { echo "dba_open failed\n"; exit; } dba_insert ("bkey", "bvalue", $id); $key = dba_firstkey ($id); while ($key != false) { echo "<br>Key: " . $key . "->Value: " . dba_fetch ( $key, $id); $key = dba_nextkey ($id); } dba_close ($id); Expected result: ---------------- To be able to insert into an existing (not created by php) db3 hash database. Actual result: -------------- [Wed Oct 8 08:56:44 2003] [error] PHP Warning: dba_open(aliases5.db,w): Driver initialization failed for handler: db3: Invalid argument in /usr/local/www/data/maillists/test3.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25794&edit=1