Has anyone successfully used db2 with PHP? I can get it to work with GDBM, 
but apparently Apache mod_db or mod_dbm on Linux can't use GDMB.

Here's how I compiled php4.0.6 on RH 6.2:

./configure --prefix=/usr/local \
--with-apxs=/usr/sbin/apxs \
--with-config-file-path=/etc/httpd/conf \
--enable-track-vars \
--enable-trans-sid \
--enable-versioning \
--enable-apc \
--with-calendar=shared \
--enable-safe-mode \
--with-db2=/usr/local/BerkeleyDB \
--with-gdbm=/usr/include \
--with-db=/usr \
--enable-mbstring \
--enable-mbstr-enc-trans \

I installed SleepyCat db3 2.7.7, but db2 is also included in the glibc RPM. 
The header files from glibc's db2 are in /usr/include but I couldn't get 
PHP to find them.

phpinfo says db2 support is available:

dba
DBA support enabled
Supported handlers gdbm db2

db
This is GDBM version 1.8.0, as of May 19, 1999.

When I try to create or edit a db2 file like this:

$dbmfile= "/tmp/testdb";
$username= "user";
$passwd= "password";
$encpasswd = crypt ($passwd);

$dbh = dba_open($dbmfile, "c", "db2") or die ("Cannot open DB $dbmfile!");
if (!dba_replace($dbh, $username, $encpasswd)) {
         print "Success";
} else {
         print "Failure";
}
dba_close($dbh);

...I get this error:

Warning: driver initialization failed in /home/richpav/php/passwd.php on line 8
Cannot open DB /tmp/testdb!

Since I'm trying to create the db in /tmp, it can't be a problem with 
permissions.

I have to use db or dbm for Apache authentication. I can't install an RDB 
such as MySQL on the corporate DMZ.

Thanks,

Rich 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to