You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Carl Brewer <ca...@bl.echidna.id.au> on 2003/07/31 09:24:22 UTC
Re: Trouble writing to a file from mod_perl
Rod Brick wrote:
> I'm trying to write for a file from a mod_perl script. I can write
> successfully to a file located in /tmp, but I cannot write to
> the dir containing the script, nor to the apache logs dir. How can
> this be accomplished? Is there a setting in httpd.conf that I
> need to specify? Is it a file permissions problem? I don't want to
> make the script dir world read/writable. Would the Apache::Log
> interface allow me to write to my own file? My code looks something
> like the following:
>
> open(LOG, ">>/usr/local/apache/htdocs/aws/perl/rod.log") || print
> "script.pl: Can't write to log file.";
> print LOG "hello\n";
> close LOG
change it to
open(LOG, ">>/usr/local/apache/htdocs/aws/perl/rod.log") || print
"script.pl: Can't write to log file : $! ";
print LOG "hello\n";
close LOG
And at least it'll tell yuo why it can't write to the file :)
Carl