Weird error

I wrote this script to count downloads and other thing on my site. It comes up with an “Internal Server Error.” My error_log says

failed to open log file
fopen: Permission denied

It also says “Pemature end of script headers.”

I took all the code out except for #!/usr/bin/perl
and it still did not work. I know it is chmoded to 755.

Here is the code:

#!/usr/bin/perl

$ENV{‘QUERY_STRING’} =~ tr/ / /;
$cat = $ENV{‘QUERY_STRING’};

open(INFO,“flash_info.dat”) or dienice(“Couldn’t open data file. $!”);
@flashinfo = ;
close(INFO);

foreach $i (@flashinfo) {
chomp($i);
($fname,$user,$plays,$dloads,$type,$location,$wi,$hi,$dload,$zip) = split(/|/,$i);
if ($fname eq $cat) {
$stuff = $i;
}
}

foreach $i ($stuff) {
chomp($i);
($fname,$user,$plays,$dloads,$type,$location,$wi,$hi,$dload,$zip) = split(/|/,$i);
}

open(INFO,">flash_info.dat") or dienice(“Couldn’t wright data to file. $!”);
flock(INFO,2);
seek(INFO,0,2);
$dloads_add = $dloads 1;
foreach $i (@flashinfo) {
chomp($i);
if ($i eq $stuff) {
print INFO “$fname|$user|$plays|$dloads_add|$type|$location|$wi|$hi|$dload|$zip\n”;
} else {
print INFO “$i\n”;
}
}

close(INFO);

print “Location:$zip\n\n”;

I can’t figure it out. Can some one tell me what is wrong?

Please help.

Brad Campbell
woochoochinchilla.com

Why the new thread?!

That error makes it look like some file can’t be written to. Try changing “flash_info.dat” to a full path like “/home/yourusername/flash_info.dat”.

Having a test script just containing the shebang (#!/usr/bin/perl) won’t work. See my last post to your original thread for a minimal test CGI script.

Cheers,
Ian