Greetings,

In order to minimise the maintenance of a website I set up a configuration file using GDBM_file, and accessed it using the tie function in Perl for a set of cgi-bin scripts. Everything has worked fine (after the usual messing about remembering to sort out permissions) under Solaris, and under linux, but I have now tried to use the same method under Debian linux and I have a problem. Everything works as I should have hoped that it would when the script is executed from the cgi-bin directory, or from anywhere else in my file tree that I have tried, but when it is accessed via http, the tie simply does not take place. I have had helpful discussions with support at my ISP and we are at a loss as to how to proceed. The code of a test script is given below:

----
#! /usr/bin/perl
use Fcntl;
use GDBM_File;
$debug=TRUE;
$rwflag=O_RDWR();
$crflag=O_CREAT();
$exflag=O_EXCL();
$exclusivelock=2;
$unlock=8;

$configdatafilename="/www/john/.../configdata";
tie %config,"GDBM_File",$configdatafilename,$rwflag|$crflag,0644
or $found=FALSE;
if ($debug eq TRUE)
{
   print 'Content-type: text/html',"\n","\n",'<html><body>hi',"<br>\n";
   if ($found eq FALSE)
   {
      print "Can't find configdata.<br>";
   }
   @keys=sort(keys(%config));
   foreach $key (@keys)
   {
     print $key,' ',$config{$key},"<br>\n";
   }
   print "hi</body></html>","\n";
}
untie %config;
exit

---
Invoked from the cgi-bin file, the script finds the configdata file, and prints the messages and the keys, and the contents of the tied hash.

Invoked via http the output is

hi
Can't find configdata
hi

The data file is not in the cgi-bin directory, but I have moved it there, and it makes no difference to the problem.

From error messages, the details of the software involved are:

Apache/2.0.54 (Debian GNU/Linux) PHP/5.2.1-0.dotdeb.1 with Suhosin-Patch mod_ssl/2.0.54 OpenSSL/0.9.7e mod_perl/1.999.21 Perl/v5.8.4

Has anybody any idea about what I am doing wrong?

John O.


_______________________________________________
Scottish mailing list
[email protected]
https://mailman.lug.org.uk/mailman/listinfo/scottish

Reply via email to