Hi

I have a very simple cgi script that I have put onto a webserver. I want
to write to a log file when it is run. My problem is that the open file
command always fails (and I get the "openFailed" message in my browser).
(even if i try opening for input it fails). I have created the file called
log.dat in the same folder as the script (cgi-bin) and set attributes to
read/write using chmod.

Is there any easy way I can find out why the file cant be opened (is it
permissions?). Do I need to fully qualify the filepath? if so how do I do
that? Is it because I'm not allowed to have log files in the cgi-bin
folder?

Any help for an absolute beginner appreciated.
steve
  

#!/usr/local/bin/perl

$Msg = "";

if( ! open (LOGFILE, ">> log.dat") ){
   $Msg = "OpenFailed";
}
else {  
        $Msg = "OpenWorked";
        #print LOGFILE $Msg;
        close (LOGFILE) ;
}

print "Content-type: text/html\n\n";

print <<"EOF";
<HTML>

<HEAD>
<TITLE>Result</TITLE>
</HEAD>
<BODY>
<TABLE DIR=LTR BORDER>
<CAPTION>$Msg</CAPTION>
<TR>
<TD>$Msg</TD>
</BODY>
</HTML>
EOF



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to