Permission problem with CGI script

Andy Selby andyfrommk at
Wed Jul 14 09:39:06 PDT 2010

'evening all,
I seem have to have a permission problem creating a 'data.txt' file to
store comments.
I think it is an Apache/perl interpreter mis-config but here is the
script anyway

#!/usr/bin/perl -wT

use strict;
use CGI qw/:standard/;

print header,start_html('Comments Form');
print h1('Comments Form');

my $time = localtime();
print $time,p;
print start_form, textarea({
        -name => "text",
        -rows => "10",
        -columns => "50",

if (param) {
        #print "you said ",(param('text')),p, #This line works, the
others below don't
        open (MYFILE, '>>data.txt') or die "couldn't open file $!";
                print MYFILE (param('text')),$time,;
        close (MYFILE);
print $!;
print end_html;

Looking in /var/log/httpd/error.log I see...

'couldn't open file Permission denied at'

I am the owner of cgi-bin/ and html/ though even if I create the
data.txt file and make it world-writeable I still get the 'couldn't
open file' line in the log
This is on a Fedora 12 install

Thanks in advance

P.S That isn't all of the script, its just that I stopped adding new
functionality when I ran into this problem.

More information about the MiltonKeynes-pm mailing list