From: Reini U. <ru...@x-...> - 2005-04-18 20:02:05
|
Alan Hoyle schrieb: > On Mon, 18 Apr 2005 at 20:02, Reini Urban wrote: > >>> lib/DbaDatabase.php:54: Error[256]: >>> dba_open(/home/alanh/html/wiki/pages/pagedb.gdbm,c): Driver >>> initialization failed for handler: gdbm: File open error >>> file: /home/alanh/html/wiki/pages/pagedb.gdbm >>> mode: c >>> handler: gdbm >>> >>> Any suggestions as to what to try? >> >> >> Yes, >> see the current sozurce of lib/DbaDatabase.php what I had to do to >> workaround gdbm bugs. >> if "c" fails try "w" with the second try. >> Only Windows needs "-" > > Hi Reini, > I'm looking at the version of DbaDatabase.php that was included in > phpwiki-1.3.11_rc1 and I don't understand quite what you mean. > > I see the following code fragment on lines 46-53: > > 46 if (check_php_version(4,3,0) and (strlen($mode) == 1)) { > 47 // PHP 4.3.x Windows lock bug workaround: > http://bugs.php.net/bug.php?id=239 47 75 > 48 if (isWindows()) { > 49 $mode .= "-"; // suppress > locking, or > 50 } elseif ($this->_handler != 'gdbm') { // gdbm > does it internally > 51 $mode .= "d"; // else use > internal locking > 52 } > 53 } > 54 while (($dbh = dba_open($this->_file, $mode, > $this->_handler)) < 1) { > 55 if ($watchdog <= 0) > 56 break; > 57 flush(); > 58 // "c" failed, try "w" instead. > 59 if (substr($mode,0,1) == "c" and > file_exists($this->_file)) > 60 $mode = "w"; > > But I don't see what I should change in here in order to make it work. > I don't see where $mode ever gets set to "c" and how I can make any > changes to make it work.... There are only two changes which affect you. The first is not important: * Randomizing (a la Ethernet collision handling) competing locks. $secs = 0.5 + ((double)rand(1,32767)/32767); sleep($secs); $watchdog -= $secs; This changed the loop. * Second, the change from "c" to "w" if the first "c" fails, in line 59-60 gdbm errors are all about locking and its improper handling within php. gdbm itself works marvelous. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ http://phpwiki.org/ |