Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    Basel, Switzerland
    Posts
    6

    Unanswered: php db3 ( Berkeley DB style) can't get it to work locally

    Hi everyone

    I'm using the db3 handler on a remote website. Everything works fine. But I would like to use it also locally. I have win 2000 with apache and php up and running (mod_dba.dll loaded) phpinfo.php gives:

    DBA support enabled
    Supported handlers cdb cdb_make db3 flatfile

    But if I open the php file I get the following error message:

    dba_open(dbfiles/ids.db,rl): Driver initialization failed for handler: db3: No such file or directory

    any ideas ?
    ----------------
    www.speich.net

  2. #2
    Join Date
    Mar 2004
    Location
    Basel, Switzerland
    Posts
    6
    I did some research. It works fine as long as the db file resides in the same directory as the php file. But as soon as you move the test.db into another subdirectory (say "test/test.db") I get the prevously posted error message. Furthermore if I publish the test.db to the remote website I cant access it and vice versa. Could this be because the remove website is unix ?
    PHP Code:
    $Count 0;
    $Rst dba_open("test.db""c""db3");
    dba_insert("1""blabla"$Rst);
    dba_insert("2""tralala"$Rst);
    $Key dba_firstkey($Rst);
    while (
    $Key) {
        echo 
    $Key." : " .dba_fetch($Key$Rst) . "<br>";
        
    $Key dba_nextkey($Rst);
        
    $Count++;
    }
    dba_close($Rst);
    echo 
    "$Count records<br>"
    ----------------
    www.speich.net

  3. #3
    Join Date
    Mar 2004
    Location
    Basel, Switzerland
    Posts
    6

    solution found

    just use $_SERVER['DOCUMENT_ROOT'] for file path, then it also works in subdir, e.g.

    $Rst = dba_open($_SERVER['DOCUMENT_ROOT']."/anydir/test.db", "c", "db3");
    ----------------
    www.speich.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •