maintaining Apache user authentication DB/DBM with PHP
| From: | Richard M. Pavonarius | Date: | Fri, 29 Jun 2001 23:13:30 +0000 |
| Subject: | maintaining Apache user authentication DB/DBM with PHP | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9983@lists.php.net to get a copy of this message | ||
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