How to Create a db4 Database With PHP

By | April 20, 2010

In order to create a blank db4 database with PHP script, all you need is to use this code:

<?
$srcfile="/path/to/db4file";
$id=dba_open($srcfile, 'c', 'db4');
dba_close($id);
?>

If you are getting an error like

PHP Fatal error:  Uncaught Error: Call to undefined function dba_open() in...

Ask your server administrator to add dba support to PHP. For a rpm-based installation the command is:

yum install php-dba