BoB
asked on
dbm write fails from cgi.
Using Perl on Rehat 6.1, I've made a dbm file template which I can work with through the standard dbmopen command. If I use the same functions through CGI, however, I get an error "store returned -1, error number 13".
For Example
dbmopen(%template, "/path/template", 0666) || die;
print $template{"foo"}; #returns value in both cases
$template{"foo"} = "bar"; #fails if performed as a cgi script
dbmclose(%template);
Any ideas why this should happen?
For Example
dbmopen(%template, "/path/template", 0666) || die;
print $template{"foo"}; #returns value in both cases
$template{"foo"} = "bar"; #fails if performed as a cgi script
dbmclose(%template);
Any ideas why this should happen?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mode 0666 should give everyone rw access to the file. That should easily cover the server user unless I need to allow execute access as well.
example:
if your dbm file is owned by root and the permissions aren't set for others to read it, mode 0666 for dbm won't mean a thing-the cgi will not open the file.
if your dbm file is owned by root and the permissions aren't set for others to read it, mode 0666 for dbm won't mean a thing-the cgi will not open the file.
ASKER
You're right, I'm wrong. Seems that's typical for beginner programmers. :) Thanks guadalupe for your input.
#!/usr/local/bin/perl
print "Content-type: text/plain\n\n";
print "Effective User is: $>\n";
print "Real User is: $<\n";