How to specify BerkeleyDB version when creating a file using perl DB_File?

It seems that we are faced with version incompatibility in BerkeleyDB between our perl scripts and our PHP scripts. Our perl scripts generate BDB, and our php scripts just 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 like:

$ file output.db
output.db: Berkeley DB (Hash, version 9, native byte-order)

But after updating sys-libs / db and DB_File, a file like this is now created:

$ file output.db
output.db: Berkeley DB (Hash, version 10, native byte-order)

In another system, we have a PHP script. When the update happened, 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 tried updating PHP, but version 10 is not yet supported.

Is there a way to tell perl DB_File to create a specific version when creating the database?

+4
source share

All Articles