log out to file using mp2 and apache2 on Fedora

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


Fedora Core 4
Mod_Perl 2.0.1
Perl 5.8.6

Sorry for the pitiful amount of Perl content, but someone here
will know the answer. Do I really need to do all this to log to
file in mp2/Apache2?

I have a cgi/web script that I run under the ModPerl::Registry handler. I
want to open a file handle and print info to that handle. I don't want to
use Apache's builtin abilities -- only the old fashion way.

It appears that Mod_perl scripts run under the same user as
Apache2, which is apache:apache. OK so far.

The first time I run my script, I run it in the console as root.
This creates the log file (mylog.dat) as root:root. I then do
chown apache:apache mylog.dat
chmod 0664 mylog.dat

After all that I can log normally. If I don't change the owner
of the log file, then the script dies when trying to open the log.

Is this approach optimal or necessary? I'm new to Linux.

thanks for your advice,

Site Timeline