You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Harry Plate <ha...@plate.net> on 2006/10/30 20:47:54 UTC

Re: print() on closed filehandle

> You ought to test if the file is really open first, and you will hopefully
> get a more helpful error message:
> 
> open(LOGFILE, ">>junk.log") or die "Cannot open logfile, $!";
> 

Good suggestion; so I add the "die" and I get the error:

*** Cannot open log file, Permission denied at /var/www/cgi-bin/test.pl...

Which certainly confirms my theory:

> It would appear that, under Apache, perl's io system has been constrained,
> disabled, broken, or ??

Note the folder and file permissions are wide open; so I would next expect
that the unix fs is *not* the one that is complaining...

So is there some kind of mod_perl/Apache setting that is unique to the RH
Enterprise Linux 4 (vs RH WS 4) ?

Again, I compared the httpd.conf and perl.conf are identical on the 2
servers.

-harry



Re: print() on closed filehandle

Posted by Frank Wiles <fr...@wiles.org>.
On Mon, 30 Oct 2006 13:15:32 -0700
Harry Plate <ha...@automaticduck.com> wrote:

> Peter,
> 
> > 
> > You can also temporarily disable SELinux by doing:
> > 
> > echo '0' > /selinux/enforce
> > 
> 
> Bingo! That was it!
> 
> So, I don't see any SELinux configuration (within Webmin, at least).
> I need to learn more about it ... How does one disable it at boot
> time? That would be a good temporary solution.

   IIRC you were running RHEL 4, so to turn it off on boot edit
   the file: 

   /etc/sysconfig/selinux 

   and set: 

   SELINUX=disabled 

   and it won't be started on boot.  Just an FYI, but you can also turn
   it off at runtime by running the following command: 
 
   setenforce 0 

   Hope that helps! 

 ---------------------------------
   Frank Wiles <fr...@wiles.org>
   http://www.wiles.org
 ---------------------------------


Re: print() on closed filehandle

Posted by Harry Plate <ha...@automaticduck.com>.
Peter,

> 
> You can also temporarily disable SELinux by doing:
> 
> echo '0' > /selinux/enforce
> 

Bingo! That was it!

So, I don't see any SELinux configuration (within Webmin, at least). I need
to learn more about it ... How does one disable it at boot time? That would
be a good temporary solution.

-h



Re: print() on closed filehandle

Posted by Peter Rosenthal <vo...@gmail.com>.
SELinux is certainly included in RHEL 4 (though it is an option at install
time whether it is enabled or not). Check your message log for avc failures.
e.g.:

kernel: audit(1162240773.996:667): avc:  denied  { write } for  pid=23025
comm="httpd" name="dprof" dev=dm-0 ino=24282699
scontext=root:system_r:httpd_t tcontext=root:object_r:httpd_config_t
tclass=dir

You can also temporarily disable SELinux by doing:

echo '0' > /selinux/enforce

On 30/10/06, Perrin Harkins <pe...@elem.com> wrote:
>
> On Mon, 2006-10-30 at 12:47 -0700, Harry Plate wrote:
> > *** Cannot open log file, Permission denied at
> /var/www/cgi-bin/test.pl...
> [...]
> > Note the folder and file permissions are wide open; so I would next
> expect
> > that the unix fs is *not* the one that is complaining...
>
> I think it probably is your fs.  Try becoming the user that you run your
> web server as and see if you can write to that directory.  I suspect
> there is an enclosing directory higher up that doesn't have the right
> permissions.
>
> > So is there some kind of mod_perl/Apache setting that is unique to the
> RH
> > Enterprise Linux 4 (vs RH WS 4) ?
>
> There's nothing in mod_perl or Apache, but Red Hat includes SELinux in
> Fedora Core.  Not sure if that's in RHEL 4 or not.
>
> - Perrin
>
>

Re: print() on closed filehandle

Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2006-10-30 at 12:47 -0700, Harry Plate wrote:
> *** Cannot open log file, Permission denied at /var/www/cgi-bin/test.pl...
[...]
> Note the folder and file permissions are wide open; so I would next expect
> that the unix fs is *not* the one that is complaining...

I think it probably is your fs.  Try becoming the user that you run your
web server as and see if you can write to that directory.  I suspect
there is an enclosing directory higher up that doesn't have the right
permissions.

> So is there some kind of mod_perl/Apache setting that is unique to the RH
> Enterprise Linux 4 (vs RH WS 4) ?

There's nothing in mod_perl or Apache, but Red Hat includes SELinux in
Fedora Core.  Not sure if that's in RHEL 4 or not.

- Perrin