We seem to have hit a version incompatibility in BerkeleyDB between our perl scripts and our PHP scripts. Our perl scripts generate BDB and our php scripts merely read them.
Our perl scripts use DB_File to create a BDB file:
use DB_File;
$DBFILE="output.db";
tie(%db, "DB_File", $DBFILE, O_RDWR | O_CREAT, 0644)
or warning("Could not open db file '$DBFILE'");
This previously created a file of type:
$ file output.db
output.db: Berkeley DB (Hash, version 9, native byte-order)
But, after an upgrade of sys-libs/db and DB_File, now creates a file of type:
$ file output.db
output.db: Berkeley DB (Hash, version 10, native byte-order)
At the other of the system we have a PHP script. When the upgrade occurred, our PHP code (based on dba_open()) started complaining about the version:
Notice: dba_open(): output.db: unsupported hash version: 10 in dbread.php on line 16
I have tried upgrading PHP, but version 10 doesn't seem to be supported yet.
Is there a way to tell perl's DB_File to create a specific version when creating the DB?
No, there is no way to tell perl's DB_File to create a specific version , AFAIK libdb itself doesn't have that feature
If you compile/link against version 4.x of libdb, then DB_File only gets to use that version
So if you need DB_File that uses libdb-4.x you will have to downgrad or install another copy in a different @INC directory
When installing this is the file you edit https://metacpan.org/source/PMQS/DB_File-1.835/config.in
Simply change DBNAME = -ldb-2.4.10
to match the version that your php install used
Specify a different install directory with https://metacpan.org/pod/ExtUtils::MakeMaker#INSTALL_BASE then tell perl where to find it with https://metacpan.org/pod/perlrun#PERL5LIB
https://metacpan.org/pod/local::lib also documents this