[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: Re: Trouble writing to a file from mod_perl
From: "Mike P. Mikhailov" <mike () sibtel ! ru>
Date: 2003-07-31 7:37:21
[Download RAW message or body]
Hello Rod Brick,
Thursday, July 31, 2003, 3:01:57 PM, you wrote:
RB> I'm trying to write for a file from a mod_perl script. I can write
RB> successfully to a file located in /tmp, but I cannot write to
RB> the dir containing the script, nor to the apache logs dir. How can
RB> this be accomplished? Is there a setting in httpd.conf that I
RB> need to specify? Is it a file permissions problem? I don't want to
RB> make the script dir world read/writable. Would the Apache::Log
RB> interface allow me to write to my own file? My code looks something
RB> like the following:
open(LOG, ">>>/usr/local/apache/htdocs/aws/perl/rod.log") || print
RB> "script.pl: Can't write to log file.";
RB> print LOG "hello\n";
RB> close LOG
RB> I'm running mod_perl 1.27 and Apache 1.3.27 on Mandrake Linux. Any
RB> help would be greatly appreciated.
RB> Rod Brick
I'm pretty sure -- this is a permission problem. You could check $!
to see the source of the problem and print it to STDERR instead of
STDOUT which under mod_perl is tied to client socket (of couse if you
want to see message in the error log).
open(...) || print STDERR "Some problem to open: $!\n";
Depends of you apache/mod_perl setup it's quite possible that your apache
processes run under user which has no privileges to write into
/usr/local/apache/htdocs/aws/perl/rod.log.
--
WBR, Mike P. Mikhailov
mailto: mike@sibtel.ru
ICQ: 280990142
Those who learn from history are doomed to have it repeated to them anyway.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic