perl in cgi with db3 files

druagord's picture

He has: 335 posts

Joined: May 2003

ok i got this script in perl that read db3 files it's all very old. i add to rewrite the way that db are open because a function was not available anymore. it now works in command line

print "Content-type: text/html\n\n";
print "<html><head><title>result</title></head><body>";
(my $db=tie( %DBMFILE,'BerkeleyDB::Hash',-Filename =>$clientdbasefile))|| (print "could not open database");
print "filename = $clientdbasefile";
foreach $key (sort keys %DBMFILE) {
                print "$key = $DBMFILE{$key}";
}
print "</body></html>";
exit;
'

but in cgi i get could not open database permision are set for the www user on the database.

IF , ELSE , WHILE isn't that what life is all about

He has: 51 posts

Joined: Jan 2004

possibly a permissions issue? Does the www user have permission to read and write to the DB?

When you run it on the command line, it's running as the user currently logged in to the command line. When you run it through CGI, its running as the www user.

Look into 'chown' and 'chgrp'

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.