php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21743 Driver initialization failed for handler: db3 (and db2)
Submitted: 2003-01-19 02:32 UTC Modified: 2003-03-10 01:00 UTC
Votes:7
Avg. Score:5.0 ± 0.0
Reproduced:7 of 7 (100.0%)
Same Version:4 (57.1%)
Same OS:1 (14.3%)
From: priyadi at priyadi dot net Assigned: helly (profile)
Status: No Feedback Package: DBM/DBA related
PHP Version: 4.3.0 OS: RedHat Linux 7.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: priyadi at priyadi dot net
New email:
PHP Version: OS:

 

 [2003-01-19 02:32 UTC] priyadi at priyadi dot net
dba_open with dba handler db2 or db3 always failed,   
however it worked with flatfile, gdbm or  cdb_make. I'm  
using dba not statically linked but loaded using dl(). I'm  
sure it worked before with php 4.2.1 and db2.  
 
phpinfo for dba: 
DBA support          enabled 
Supported handlers   gdbm cdb cdb_make db3 flatfile 
  
Code example:  
<?  
dl("dba.so");  
$a = dba_open("test", "c", "db3");  
?>  
  
The output is:  
$ php db.php  
Content-type: text/html  
X-Powered-By: PHP/4.3.0  
  
<br />  
<b>Warning</b>:  dba_open(test,c) [<a  
href='http://www.php.net/function.dba-open'>function.dba-open</a>]:  
Driver initialization failed for handler: db3 in  
<b>/home/u1094/db.php</b> on line <b>3</b><br />  
  
After it is executed, a zero sized file 'test' appears.  
  
ldd information:  
$ ldd /usr/local/lib/php/modules/dba.so  
        libz.so.1 => /usr/lib/libz.so.1 (0x4001a000)  
        libdb-3.2.so => /lib/libdb-3.2.so (0x40028000)  
        libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0x400cf000)  
        libc.so.6 => /lib/libc.so.6 (0x400d6000)  
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2  
(0x80000000)  
$ ldd /usr/local/bin/php  
        libz.so.1 => /usr/lib/libz.so.1 (0x40027000)  
        libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0x40035000)  
        libm.so.6 => /lib/libm.so.6 (0x4003c000)  
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x4005e000)  
        libpam.so.0 => /lib/libpam.so.0 (0x4008b000)  
        libssl.so.2 => /lib/libssl.so.2 (0x40094000)  
        libcrypto.so.2 => /lib/libcrypto.so.2 (0x400c1000)  
        libresolv.so.2 => /lib/libresolv.so.2 (0x40184000)  
        libdl.so.2 => /lib/libdl.so.2 (0x40196000)  
        libnsl.so.1 => /lib/libnsl.so.1 (0x4019a000)  
        libc.so.6 => /lib/libc.so.6 (0x401b1000)  
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2  
(0x40000000)  
  
  
Strace output:  
(this is for db3, I can give you the output for db2 if  
needed after I finished recompiling. you can't have both 
db2 and db3 compiled in right?)  
9504  execve("/usr/bin/php", ["php", "db.php"], [/* 31  
vars */]) = 0  
9504  uname({sys="Linux",  
node="geodude.labs.indoglobal.com", ...}) = 0  
9504  brk(0)                            = 0x819d96c  
9504  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40016000  
9504  open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No  
such file or directory)  
9504  open("/etc/ld.so.cache", O_RDONLY) = 3  
9504  fstat64(3, {st_mode=S_IFREG|0644, st_size=64982,  
...}) = 0  
9504  old_mmap(NULL, 64982, PROT_READ, MAP_PRIVATE, 3, 0)  
= 0x40017000  
9504  close(3)                          = 0  
9504  open("/usr/lib/libz.so.1", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\31\0"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=59618,  
...}) = 0  
9504  old_mmap(NULL, 54824, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x40027000  
9504  mprotect(0x40033000, 5672, PROT_NONE) = 0  
9504  old_mmap(0x40033000, 8192, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0xb000) = 0x40033000  
9504  close(3)                          = 0  
9504  open("/usr/lib/libgdbm.so.2", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\24\0\000"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=30114,  
...}) = 0  
9504  old_mmap(NULL, 24908, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x40035000  
9504  mprotect(0x4003a000, 4428, PROT_NONE) = 0  
9504  old_mmap(0x4003a000, 8192, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x4000) = 0x4003a000  
9504  close(3)                          = 0  
9504  open("/lib/libm.so.6", O_RDONLY)  = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320H\0"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=615554,  
...}) = 0  
9504  old_mmap(NULL, 138964, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x4003c000  
9504  mprotect(0x4005d000, 3796, PROT_NONE) = 0  
9504  old_mmap(0x4005d000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x20000) = 0x4005d000  
9504  close(3)                          = 0  
9504  open("/lib/libcrypt.so.1", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\17\0\000"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=87059,  
...}) = 0  
9504  old_mmap(NULL, 184188, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x4005e000  
9504  mprotect(0x40063000, 163708, PROT_NONE) = 0  
9504  old_mmap(0x40063000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x4000) = 0x40063000  
9504  old_mmap(0x40064000, 159612, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40064000  
9504  close(3)                          = 0  
9504  open("/lib/libpam.so.0", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\25\0"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=35424,  
...}) = 0  
9504  old_mmap(NULL, 32360, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x4008b000  
9504  mprotect(0x40092000, 3688, PROT_NONE) = 0  
9504  old_mmap(0x40092000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x6000) = 0x40092000  
9504  close(3)                          = 0  
9504  open("/lib/libssl.so.2", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0  
\221\0"..., 1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=207036,  
...}) = 0  
9504  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40093000  
9504  old_mmap(NULL, 182976, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x40094000  
9504  mprotect(0x400be000, 10944, PROT_NONE) = 0  
9504  old_mmap(0x400be000, 12288, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x29000) = 0x400be000  
9504  close(3)                          = 0  
9504  open("/lib/libcrypto.so.2", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\2206\2"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=918752,  
...}) = 0  
9504  old_mmap(NULL, 798144, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x400c1000  
9504  mprotect(0x40175000, 60864, PROT_NONE) = 0  
9504  old_mmap(0x40175000, 49152, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0xb3000) = 0x40175000  
9504  old_mmap(0x40181000, 11712, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40181000  
9504  close(3)                          = 0  
9504  open("/lib/libresolv.so.2", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\'\0"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=261262,  
...}) = 0  
9504  old_mmap(NULL, 71072, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x40184000  
9504  mprotect(0x40192000, 13728, PROT_NONE) = 0  
9504  old_mmap(0x40192000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0xd000) = 0x40192000  
9504  old_mmap(0x40193000, 9632, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40193000  
9504  close(3)                          = 0  
9504  open("/lib/libdl.so.2", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200\35"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=65405,  
...}) = 0  
9504  old_mmap(NULL, 12532, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x40196000  
9504  mprotect(0x40198000, 4340, PROT_NONE) = 0  
9504  old_mmap(0x40198000, 8192, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x1000) = 0x40198000  
9504  close(3)                          = 0  
9504  open("/lib/libnsl.so.1", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p?\0\000"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=448337,  
...}) = 0  
9504  old_mmap(NULL, 91932, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x4019a000  
9504  mprotect(0x401ad000, 14108, PROT_NONE) = 0  
9504  old_mmap(0x401ad000, 8192, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x12000) = 0x401ad000  
9504  old_mmap(0x401af000, 5916, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401af000  
9504  close(3)                          = 0  
9504  open("/lib/libc.so.6", O_RDONLY)  = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\303"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=5723311,  
...}) = 0  
9504  old_mmap(NULL, 1265288, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x401b1000  
9504  mprotect(0x402dd000, 36488, PROT_NONE) = 0  
9504  old_mmap(0x402dd000, 20480, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x12b000) = 0x402dd000  
9504  old_mmap(0x402e2000, 16008, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x402e2000  
9504  close(3)                          = 0  
9504  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x402e6000  
9504  munmap(0x40017000, 64982)         = 0  
9504  rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0  
9504  brk(0)                            = 0x819d96c  
9504  brk(0x819d9a4)                    = 0x819d9a4  
9504  brk(0x819e000)                    = 0x819e000  
9504  brk(0x819f000)                    = 0x819f000  
9504  brk(0x81a0000)                    = 0x81a0000  
9504  brk(0x81a1000)                    = 0x81a1000  
9504  open("/usr/share/locale/locale.alias", O_RDONLY) = 3  
9504  fstat64(3, {st_mode=S_IFREG|0644, st_size=2601,  
...}) = 0  
9504  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000  
9504  read(3, "# Locale name alias data base.\n#"...,  
4096) = 2601  
9504  read(3, "", 4096)                 = 0  
9504  close(3)                          = 0  
9504  munmap(0x40017000, 4096)          = 0  
9504  open("/usr/lib/locale/en_US/LC_CTYPE", O_RDONLY) = 3  
9504  fstat64(3, {st_mode=S_IFREG|0644, st_size=173408,  
...}) = 0  
9504  old_mmap(NULL, 173408, PROT_READ, MAP_PRIVATE, 3, 0)  
= 0x402e7000  
9504  close(3)                          = 0  
9504  brk(0x81a5000)                    = 0x81a5000  
9504  open("./php-cgi.ini", O_RDONLY)   = -1 ENOENT (No  
such file or directory)  
9504  open("php/php-cgi.ini", O_RDONLY) = -1 ENOENT (No  
such file or directory)  
9504  open("/usr/local/lib/php/php-cgi.ini", O_RDONLY) =  
-1 ENOENT (No such file or directory)  
9504  open("./php.ini", O_RDONLY)       = -1 ENOENT (No  
such file or directory)  
9504  open("php/php.ini", O_RDONLY)     = -1 ENOENT (No  
such file or directory)  
9504  open("/usr/local/lib/php/php.ini", O_RDONLY) = -1  
ENOENT (No such file or directory)  
9504  brk(0x81a6000)                    = 0x81a6000  
9504  brk(0x81a7000)                    = 0x81a7000  
9504  brk(0x81a8000)                    = 0x81a8000  
9504  brk(0x81a9000)                    = 0x81a9000  
9504  brk(0x81aa000)                    = 0x81aa000  
9504  brk(0x81ab000)                    = 0x81ab000  
9504  brk(0x81ac000)                    = 0x81ac000  
9504  brk(0x81ad000)                    = 0x81ad000  
9504  brk(0x81ae000)                    = 0x81ae000  
9504  brk(0x81af000)                    = 0x81af000  
9504  brk(0x81b0000)                    = 0x81b0000  
9504  brk(0x81b1000)                    = 0x81b1000  
9504  brk(0x81b2000)                    = 0x81b2000  
9504  brk(0x81b3000)                    = 0x81b3000  
9504  brk(0x81b4000)                    = 0x81b4000  
9504  brk(0x81b5000)                    = 0x81b5000  
9504  brk(0x81b6000)                    = 0x81b6000  
9504  brk(0x81b7000)                    = 0x81b7000  
9504  brk(0x81b8000)                    = 0x81b8000  
9504  brk(0x81b9000)                    = 0x81b9000  
9504  brk(0x81ba000)                    = 0x81ba000  
9504  brk(0x81bb000)                    = 0x81bb000  
9504  brk(0x81bc000)                    = 0x81bc000  
9504  brk(0x81bd000)                    = 0x81bd000  
9504  brk(0x81bf000)                    = 0x81bf000  
9504  brk(0x81c0000)                    = 0x81c0000  
9504  brk(0x81c1000)                    = 0x81c1000  
9504  brk(0x81c2000)                    = 0x81c2000  
9504  brk(0x81c3000)                    = 0x81c3000  
9504  brk(0x81c4000)                    = 0x81c4000  
9504  brk(0x81c5000)                    = 0x81c5000  
9504  brk(0x81c6000)                    = 0x81c6000  
9504  brk(0x81c8000)                    = 0x81c8000  
9504  brk(0x81c9000)                    = 0x81c9000  
9504  brk(0x81ca000)                    = 0x81ca000  
9504  brk(0x81cb000)                    = 0x81cb000  
9504  brk(0x81cc000)                    = 0x81cc000  
9504  brk(0x81cd000)                    = 0x81cd000  
9504  setitimer(ITIMER_PROF, {it_interval={0, 0},  
it_value={30, 0}}, NULL) = 0  
9504  rt_sigaction(SIGPROF, {0x81199e0, [PROF],  
SA_RESTART|0x4000000}, {SIG_DFL}, 8) = 0  
9504  rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0  
9504  brk(0x81ce000)                    = 0x81ce000  
9504  brk(0x81cf000)                    = 0x81cf000  
9504  brk(0x81d0000)                    = 0x81d0000  
9504  time(NULL)                        = 1042964173  
9504  getpid()                          = 9504  
9504  gettimeofday({1042964173, 833983}, NULL) = 0  
9504  getpid()                          = 9504  
9504  open("db.php", O_RDONLY)          = 3  
9504  fstat64(3, {st_mode=S_IFREG|0664, st_size=55, ...})  
= 0  
9504  getcwd("/home/u1094", 4095)       = 12  
9504  lstat64("/home", {st_mode=S_IFDIR|0755,  
st_size=4096, ...}) = 0  
9504  lstat64("/home/u1094", {st_mode=S_IFDIR|0750,  
st_size=4096, ...}) = 0  
9504  lstat64("/home/u1094/db.php", {st_mode=S_IFREG|0664,  
st_size=55, ...}) = 0  
9504  fstat64(3, {st_mode=S_IFREG|0664, st_size=55, ...})  
= 0  
9504  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000  
9504  read(3, "<?\ndl(\"dba.so\");\n$a = dba_open(\""...,  
4096) = 55  
9504  _llseek(3, 0, [0], SEEK_SET)      = 0  
9504  getcwd("/home/u1094", 4095)       = 12  
9504  lstat64("/home/u1094/db.php", {st_mode=S_IFREG|0664,  
st_size=55, ...}) = 0  
9504  setitimer(ITIMER_PROF, {it_interval={0, 0},  
it_value={0, 0}}, NULL) = 0  
9504  setitimer(ITIMER_PROF, {it_interval={0, 0},  
it_value={30, 0}}, NULL) = 0  
9504  rt_sigaction(SIGPROF, {0x81199e0, [PROF],  
SA_RESTART|0x4000000}, {0x81199e0, [PROF],  
SA_RESTART|0x4000000}, 8) = 0  
9504  rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 8) = 0  
9504  read(3, "<?\ndl(\"dba.so\");\n$a = dba_open(\""...,  
8192) = 55  
9504  read(3, "", 4096)                 = 0  
9504  read(3, "", 8192)                 = 0  
9504  brk(0x81d1000)                    = 0x81d1000  
9504  close(3)                          = 0  
9504  munmap(0x40017000, 4096)          = 0  
9504  open("/usr/lib/php/modules/dba.so", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20)\0\000"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0644, st_size=40599,  
...}) = 0  
9504  old_mmap(NULL, 35100, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x40017000  
9504  mprotect(0x4001f000, 2332, PROT_NONE) = 0  
9504  old_mmap(0x4001f000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0x7000) = 0x4001f000  
9504  close(3)                          = 0  
9504  open("/etc/ld.so.cache", O_RDONLY) = 3  
9504  fstat64(3, {st_mode=S_IFREG|0644, st_size=64982,  
...}) = 0  
9504  old_mmap(NULL, 64982, PROT_READ, MAP_PRIVATE, 3, 0)  
= 0x40312000  
9504  close(3)                          = 0  
9504  open("/lib/libdb-3.2.so", O_RDONLY) = 3  
9504  read(3,  
"\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\6\1"...,  
1024) = 1024  
9504  fstat64(3, {st_mode=S_IFREG|0755, st_size=754870,  
...}) = 0  
9504  old_mmap(NULL, 682572, PROT_READ|PROT_EXEC,  
MAP_PRIVATE, 3, 0) = 0x40322000  
9504  mprotect(0x403c7000, 6732, PROT_NONE) = 0  
9504  old_mmap(0x403c7000, 8192, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED, 3, 0xa4000) = 0x403c7000  
9504  close(3)                          = 0  
9504  munmap(0x40312000, 64982)         = 0  
9504  getcwd("/home/u1094", 4095)       = 12  
9504  lstat64("/home", {st_mode=S_IFDIR|0755,  
st_size=4096, ...}) = 0  
9504  lstat64("/home/u1094", {st_mode=S_IFDIR|0750,  
st_size=4096, ...}) = 0  
9504  lstat64("/home/u1094/test", 0xbfffab40) = -1 ENOENT  
(No such file or directory)  
9504  open("/home/u1094/test", O_RDWR|O_APPEND|O_CREAT,  
0666) = 3  
9504  fstat64(3, {st_mode=S_IFREG|0664, st_size=0, ...}) =  
0  
9504  old_mmap(NULL, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40020000  
9504  fstat64(3, {st_mode=S_IFREG|0664, st_size=0, ...}) =  
0  
9504  _llseek(3, 0, [0], SEEK_SET)      = 0  
9504  fstat64(3, {st_mode=S_IFREG|0664, st_size=0, ...}) =  
0  
9504  lseek(3, 0, SEEK_SET)             = 0  
9504  fcntl64(0x3, 0x7, 0xbfffcd10, 0x81d0aec) = 0  
9504  stat64("test", {st_mode=S_IFREG|0664, st_size=0,  
...}) = 0  
9504  brk(0x81d2000)                    = 0x81d2000  
9504  open("test", O_RDWR|O_LARGEFILE)  = 4  
9504  fcntl64(0x4, 0x2, 0x1, 0x1a4)     = 0  
9504  fstat64(4, {st_mode=S_IFREG|0664, st_size=0, ...}) =  
0  
9504  _llseek(4, 0, [0], SEEK_SET)      = 0  
9504  read(4, "", 256)                  = 0  
9504  select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)  
9504  open("test", O_RDWR|O_LARGEFILE)  = 5  
9504  fcntl64(0x5, 0x2, 0x1, 0x1a4)     = 0  
9504  _llseek(5, 0, [0], SEEK_SET)      = 0  
9504  read(5, "", 256)                  = 0  
9504  select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)  
9504  open("test", O_RDWR|O_LARGEFILE)  = 6  
9504  fcntl64(0x6, 0x2, 0x1, 0x1a4)     = 0  
9504  _llseek(6, 0, [0], SEEK_SET)      = 0  
9504  read(6, "", 256)                  = 0  
9504  select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)  
9504  open("test", O_RDWR|O_LARGEFILE)  = 7  
9504  fcntl64(0x7, 0x2, 0x1, 0x1a4)     = 0  
9504  _llseek(7, 0, [0], SEEK_SET)      = 0  
9504  read(7, "", 256)                  = 0  
9504  close(7)                          = 0  
9504  fcntl64(0x3, 0x7, 0xbfffccf0, 0x81d0aec) = 0  
9504  close(3)                          = 0  
9504  munmap(0x40020000, 4096)          = 0  
9504  write(1, "Content-type: ", 14)    = 14  
9504  write(1, "text/html", 9)          = 9  
9504  write(1, "\r\n", 2)               = 2  
9504  write(1, "X-Powered-By: PHP/4.3.0", 23) = 23  
9504  write(1, "\r\n", 2)               = 2  
9504  write(1, "\r\n", 2)               = 2  
9504  write(1, "<br />\n<b>Warning</b>:  dba_open"...,  
211) = 211  
9504  munmap(0x40017000, 35100)         = 0  
9504  munmap(0x40322000, 682572)        = 0  
9504  setitimer(ITIMER_PROF, {it_interval={0, 0},  
it_value={0, 0}}, NULL) = 0  
9504  _exit(0)                          = ?  
  
  
Configure command:  
(basically I compiled features as external modules as much  
as possible)  
./configure \  
    --enable-cgi \  
    --disable-force-cgi-redirect \  
    --enable-discard-path \  
    --disable-debug \  
    --with-config-file-path=/usr/local/lib/php \  
    --enable-magic-quotes \  
    --disable-rpath \  
    --with-openssl \  
    \  
    --enable-bcmath=shared \  
    --with-bz2=shared \  
    --enable-calendar=shared \  
    --enable-ctype=shared \  
    --with-curl=shared \  
    --with-db=shared \  
    --enable-dbase=shared \  
    --enable-dbx=shared \  
    --enable-dio=shared \  
    --enable-exif=shared \  
    --enable-filepro=shared \  
    --with-fribidi=shared \  
    --enable-ftp=shared \  
    --with-gd=shared \  
        --with-ttf \  
        --with-t1lib \  
        --enable-gd-native-ttf \  
        --with-freetype-dir \  
    --with-gettext=shared \  
    --with-dom=shared \  
        --with-dom-xslt \  
        --with-dom-exslt \  
    --with-gmp=shared \  
    --with-iconv=shared \  
    --with-imap=shared \  
        --with-kerberos=/usr/kerberos \  
    --with-interbase=shared \  
    --with-ldap=shared \  
    --with-mcrypt=shared \  
    --with-mhash=shared \  
    --enable-mime-magic=shared \  
    --with-ming=shared \  
    --with-mnogosearch=shared,/usr \  
    --with-mysql=shared \  
    --with-ncurses=shared \  
    --with-unixODBC=shared \  
    --enable-overload=shared \  
    --enable-pcntl=shared \  
    --with-pgsql=shared \  
    --enable-posix=shared \  
    --with-pspell=shared \  
    --with-recode=shared \  
    --enable-session \  
    --enable-shmop=shared \  
    --with-snmp=shared \  
    --enable-sockets=shared \  
    --with-swf=shared,$RPM_BUILD_DIR/swflib \  
    --with-sybase=shared,/usr \  
    --enable-sysvmsg=shared \  
    --enable-sysvsem=shared \  
    --enable-sysvshm=shared \  
    --enable-tokenizer=shared \  
    --enable-wddx=shared \  
    --enable-xml \  
    --with-xmlrpc=shared \  
    --enable-xslt=shared \  
        --with-xslt-sablot \  
        --with-sablot-js \  
    --enable-yp=shared \  
    --with-pdflib=shared \  
        --with-tiff-dir=/usr \  
        --with-png-dir=/usr \  
        --with-zlib-dir=/usr \  
        --with-jpeg-dir=/usr \  
    --enable-mbstring \  
        --enable-mbregex \  
    --with-zip=shared \  
    --with-pcre-regex \  
    --with-zlib=shared \  
    --with-yaz=shared \  
    --enable-dba=shared \  
        --with-gdbm \  
        --with-db3 \  
        --with-cdb=/usr \  
        --with-flatfile \  
    \  
    --with-pic \  
    --enable-shared=yes \  
    --enable-inline-optimization \  
    --enable-zend-multibyte \  
    --disable-static \  
    --with-pear  
  

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-25 14:18 UTC] helly@php.net
First please try this (note the "-" after "c":
<?  
dl("dba.so");  
$a = dba_open("test", "c-", "db3");  
?>  

Then please try if you can create and open an new file:
<?  
dl("dba.so");  
$a = dba_open("test2", "n-", "db3"); 
var_dump($a);
dba_close($a);
$b = dba_open("test2", "r-", "db3");
var_dump($b);
dba_close($b);
?>  


after that: From your configure script:
--enable-dba=shared \  
        --with-gdbm \  
        --with-db3 \  
        --with-cdb=/usr \  
        --with-flatfile \ 

This means you cannot have db2.

However you found a problem here: --with-cdb always loads
the internal cdb support (so thanks here i've fixed
this part already in cvs).

Could you try (with only db3, cdb and flatfile)
--enable-dba=shared \  
        --with-db3 \  
        --with-cdb \  
        --with-flatfile \ 


Maybe you could also try db4 or db4.1 versions buy 
--with-db3=/path/to/db4 for PHP 4.3 or --with-db4 for cvs versions. 

If this solves the problem then it is gdbm....

The zero length test file is created by the locking 
mechanism and after that calls to library should do
the rest but that failed...
 [2003-01-26 00:21 UTC] priyadi at priyadi dot net
> First please try this (note the "-" after "c":         
> <?           
> dl("dba.so");           
> $a = dba_open("test", "c-", "db3");           
> ?>           
         
It is working!        
        
# php 2.php        
Content-type: text/html        
X-Powered-By: PHP/4.3.0        
        
        
# ls -al test        
-rw-r--r--    1 root     root         8192 Jan 26 12:34        
test        
# file test        
test: Berkeley DB (Btree, version 8, native byte-order)        
        
         
> Then please try if you can create and open an new file:         
> <?           
> dl("dba.so");           
> $a = dba_open("test2", "n-", "db3");          
> var_dump($a);         
> dba_close($a);         
> $b = dba_open("test2", "r-", "db3");         
> var_dump($b);         
> dba_close($b);         
> ?>           
        
It is working...        
        
# php 3.php         
Content-type: text/html        
X-Powered-By: PHP/4.3.0        
        
resource(1) of type (dba)        
resource(2) of type (dba)        
        
        
> after that: From your configure script:         
> --enable-dba=shared \           
>        --with-gdbm \           
>        --with-db3 \           
>        --with-cdb=/usr \           
>        --with-flatfile \          
>         
> This means you cannot have db2.         
         
> However you found a problem here: --with-cdb always         
loads         
> the internal cdb support (so thanks here i've fixed         
> this part already in cvs).         
        
OK, while we are at this, it seems there is another        
related problem. --without-db3 (or db2, flatfile, and       
others too) doesn't seem to be working. configure will     
show that db3 will not be included (checking for Berkeley     
DB3 support... no), but it will still be included if it     
finds one on my system, and the resulting binary will not     
be linked to DB3 library as shown by ldd. And     
--without-flatfile (and maybe --without-cdb too) will     
cause undefined symbol error but I think you already know    
that :)    
        
> Could you try (with only db3, cdb and flatfile)         
> --enable-dba=shared \           
>         --with-db3 \           
>         --with-cdb \           
>         --with-flatfile \          
     
Doesn't work. :(     
     
> Maybe you could also try db4 or db4.1 versions buy          
> --with-db3=/path/to/db4 for PHP 4.3 or --with-db4 for         
cvs versions.          
         
I'll get back to you later on this after I finally 
finished downloading and compiling (the sql worm thing is 
still wreaking havoc here) 
   
On a side note, ext/dba from PHP 4.2.1 works (phpize'ed),  
maybe because it doesn't have locking? 
 
Oh, is it possible that BerkeleyDB has its own locking 
mechanism that is conflicting with PHP's? Consider this 
scenario: 
- on dba_open, php locks the berkeley db file 
- php then handles opening the db file to berkeley db 
library 
- berkeley db tries to lock the file, but since it is 
already locked by php it will eventually time out 
 
From berkeley db documentation, it seems that it does its 
own locking. 
http://www.sleepycat.com/docs/ref/lock/intro.html
 [2003-01-26 08:01 UTC] helly@php.net
I've reconfigured my system with shared dba and db3-3.3
and cannot reproduce you results. Hopefully i can get a
copy of the db-3.2 source distrubution which is no longer
online :-(
 [2003-01-26 23:49 UTC] priyadi at priyadi dot net
I've tested it with db3-3.3 (RedHat 7.3) and also   
experienced the same result :(. 
 
Older berkeley db sources can be obtained from 
http://rpmfind.net as SRPMSs.  
 
I've also uploaded my binary dba.so to 
http://priyadi.net/php/dba.so if that will help. It is 
compiled with --with-flatfile --with-cdb --with-db3. 
Compiled on a RedHat 7.2 system, and db3-3.2.9.
 [2003-01-29 18:59 UTC] helly@php.net
Called my contact at Berkeley and got the link to the 3.2
version. Now i am able to reproduce a segfault...I'll look
into deeper ASAP
 [2003-01-30 11:38 UTC] priyadi at priyadi dot net
I also encountered segfaults with db4 compiled with 
--with-db3=dir but not with db3 supplied by redhat.
 [2003-01-31 01:28 UTC] helly@php.net
Please update: ext/dba/config.m4

This fixes some problems when linking against a specific
library version. If you do not use your systems default
db library you must not include ndbm support since that
is based on db1 which in turn is db-1.85 or based on db-x
where x is 1.85 or x >= 2.

I tried the following:
- db-3.2 (not shared) and it works.
- db-4.1.25 (shared/not shared) and it works.
- db-3.3 from system rpm (not shared) and it works.
- db-3.3 from source (shared) and it works

So i will ask sleepycat for known problems and maybe
disable shared dba in case of db-3.2.

I missed to answer your question: db libraries *can*
do file locking but we tell the library not to do so and 
use our own locking.

To unalize your db4 problems: What extact version are you 
using (ldd) and which config (but ldd should be enough).
 [2003-02-06 09:29 UTC] priyadi at priyadi dot net
Hello, sorry for not responding for so long. I have 
another observation to this elusive problem. 
 
- It fails when using mode 'c' but the file doesn't exist 
already 
- It succeeds when using mode 'n' and the file doesn't 
already exist 
- It succeeds when using mode 'c' and the file exists and 
it is a valid db3 btree 
- It fails when using mode 'c' and the file exists but it 
is not a valid db3 btree 
 
Regarding db4 version, I lost access to the system but I 
think it is version 4.0.14.
 [2003-02-21 13:01 UTC] rmallett at ccs dot carleton dot ca
I encountered the same problem on a Sun Solaris 8 system running apache-1.3.27 and with php 4.3.0 installed as an
apache module with dba enabled and db-4.1.25 available as db3, and adding the "-" to the mode flag (c or n) as per your suggestion (helly@php.net) fixed the problem so it looks like the theory that its a locking problem is right. 

Anything I should try to help you to fix the problem? I was using the simple example from the PHP manual for testing BTW; that is,

<?php
 $id = dba_open ("/tmp/test.db", "n", "db3");

 if (!$id) {
     echo "dba_open failed\n";
     exit;
 }

 dba_replace ("key", "This is an example!", $id);

 if (dba_exists ("key", $id)) {
     echo dba_fetch ("key", $id);
     dba_delete ("key", $id);
 }

 dba_close ($id);

?>

which gives the "Driver initialization failed ..." but
which works with "n-".
 [2003-02-22 05:14 UTC] helly@php.net
To priyadi:
 - (1) strange, maybe you can send me a strace outut
       but not on the list to helly@php.net is enough.
 - (4) if the file uses another db layout (e.g. different
       major release) you will have to updragde the file.
       But you should have received an errormessage which
       informs about that.

To rmallet:
 This is intereseting. I suspect more a problem with the
 way php locks the file since we do not use the locking
 facilities of the library. So the output of strace would
 help, again to helly@php.net is enough.
 [2003-03-10 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC