php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17559 dba_open() fails when using the db3 handler.
Submitted: 2002-06-01 23:37 UTC Modified: 2002-08-19 19:24 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: oceanwave-nospam- at linkline-nospam- dot com Assigned:
Status: Closed Package: DBM/DBA related
PHP Version: 4.2.1 OS: Windows XP Professional
Private report: No CVE-ID: None
 [2002-06-01 23:37 UTC] oceanwave-nospam- at linkline-nospam- dot com
When calling dba_open on Win32 (Apache version 1.3.24) using the db3 handler, it returns the following:

Warning: driver initialization failed in d:\docroot\dbawrite.php on line 2

The code is as follows (part of a news system):

function loadarticledb() {
   return(dba_open("./nnews/articles.dbm", "c", "db3");
}

The function should create articles.dbm if it doesn't exist, as stated in the docs. I have php_dba.dll included as an extension (specified in php.ini), and phpinfo()'s dba section shows that dba is enabled and the db3 handler is the only available handler. I've been working at fixing this for a very long time, and any help is appreciated.

Thanks in advance!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-20 23:51 UTC] php at eli dot users dot panix dot com
I've got code that that uses dba_open() with the db3
handler and works with php4.1.2 on apache 1.3.19; yet the
same code fails with php4.1.2 and apache 1.3.26. 

  if(extension_loaded("dba")) {
    echo "okay  - dba extension loaded<br>\n";

    if(strlen($DB)) { # set in httpd.conf
      $dbtype = $DB;
      echo "okay        - db is $DB<br>\n";
    } else {
      $dbtype = "db2";
      echo "okay        - using db2<br>\n";
    }
    $dbfile = "/usr/local/httpd/search/test-tuidb";    # info by tui
    if(file_exists($dbfile)) {
      echo "okay  - tuidb file $dbfile found<br>\n";
      $id = dba_open($dbfile, "r", $dbtype);
      if ($id) {
        echo "okay  - open worked<br>\n";
        $key = "tui";
        if(dba_exists($key, $id)) {
          $keys = dba_fetch($key, $id);
          echo "okay  - 'tui' entry is $keys<br>\n";
        } else {
          echo "bad  - no 'tui' entry found<br>\n";
        }

      } else {
        echo "bad  - open failed; ";
        echo "PHP error message: $php_errormsg<br>\n";
      }
    } else {
      echo "bad   - tuidb file not found<br>\n";
    }

  } // if dba extension loaded
  else {
    echo "bad   - no dba extension<br>\n";
  }

On the working machine: 
okay	- dba extension loaded<br>
okay	- db is db3<br>
okay  - tuidb file /usr/local/httpd/search/test-tuidb found<br>
okay  - open worked<br>
okay  - 'tui' entry is YES OH YES

On the non-working machine:okay	- dba extension loaded<br>
okay	- db is db3<br>
okay  - tuidb file /usr/local/httpd/search/test-tuidb found<br>
<br>
<b>Warning</b>:  driver initialization failed in <b>/usr/local/httpd/html/winamp/testit.html</b> on line <b>23</b><br>
bad  - open failed; PHP error message: <br>


On both machines PHP was built with the same config options,
apache was built with the same config options, the apache
config files are largely the same (hostname and IP are
changed), php conf files are identical. If I swap binaries
and leave all the conf and html files as is, I can duplicate
either situation on either machine.

Here's how I configured PHP:
'./configure' \
'--with-db3' \
'--with-apxs=/usr/sbin/apxs' \
'--with-mysql=/usr/' \
'--enable-bcmath' \
'--with-config-file-path=/etc/httpd/conf' \
"$@"

Here's how I configured Apache:
./configure \
"--with-layout=Mine" \
"--enable-module=all" \
"--enable-shared=max" \
"--with-perl=/usr/bin/perl" \
"$@"

For kicks I just built PHP 4.2.1: same broken behaviour.

It sure looks like something in the new apache is breaking
this, but what? Why?
 [2002-07-10 05:15 UTC] bugs at timj dot co dot uk
Have experienced the same problem on Linux.

With two i386 machines, here were our findings:

Machine that fails
------------------
- Red Hat 7.2 base
- Apache: 1.3.26 compiled from source
- PHP: 4.2.1 compiled from source using (amongst others) --with-db3

Machine that works
------------------
- Red Hat 7.3 base
- Apache: 1.3.23-14 (Red Hat binary RPM)
- PHP: 4.2.1 compiled from source using (amongst others) --with-db3
 [2002-07-10 06:55 UTC] bugs at timj dot co dot uk
Further to my above comment, it also does the same thing with --with-db2.
 [2002-08-19 19:24 UTC] sfox@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

I can only replicate this if I don't have the path right.

Please check that you're creating the correct path to an existing directory.
 [2002-09-14 16:06 UTC] sverker at sics dot se
This confused me too, but "sfox" resolute(?) reply made me look again. The problem is not only with incorrect paths, but appears also when the file exists and has a non-db3 format.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Nov 05 02:01:31 2024 UTC