#59 No error message on dba open failure


In the dba (and dbm, too, I think) backend, error
messages which occur when the database files are opened
are supressed.

If PhpWiki is miscuonfigured in such a way that the dba
open fails, no indication as to the reason for the
failure is given to the user.

This commonly happens in the case that the users PHP4
has dba support, but does not include support the gdbm
driver. In this case index.php (with default
lib/config.php) produces a blank page. (In this case
the fix is probably to use the 'db2' driver instead of
the gdbm driver --- this currently requires editing
line 42 of lib/dbalib.php.)

What should (probably) be done:

  1. PhpWiki should produce an error message when
    dba_open() fails.

  2. The choice of backend type should be moved into
    lib/config.php. (Perhaps the appropriate backend could
    be automatically deduced?)

  3. The installation docs should make some mention of
    this problem, as it seems to have become a FAQ.


  • Steve Wainstead

    Steve Wainstead - 2001-11-07

    Logged In: YES

    I've updated the INSTALL, lib/config.php and lib/dbalib.php
    files. There is a constant now in config.php, DBM_FILE_TYPE
    which is 'gdbm' by default. The INSTALL notes that if the
    user gets a blank page on startup, this might be the problem.


  • Steve Wainstead

    Steve Wainstead - 2001-11-07

    Logged In: YES

    Also... the problem with dba_lib() is: it will fail if
    someone else has the file open. This is why I used the '@'
    to supress the error message. Without the '@' the user might
    see 20 or so error messages and then the page will display
    when the file is opened after the other process closes it.

    It returns 'false' for any error it encounters. There is no
    way, it seems, to tell a "file was in use" error from "this
    OS doesn't support that file type."

  • Jude Walker

    Jude Walker - 2001-11-28

    Logged In: YES

    Also, it's possible (as it was in my case) that the
    PHP installation is missing DBA support totally. You
    sort of alluded to that already, but it's important
    to verify that DBA support is enabled by looking at
    ?phpinfo() right away. Thanks for the comments and help.


Log in to post a comment.