Problems with Apache 2.0, mod_perl2 and perl
Problems with Apache 2.0, mod_perl2 and perl
am 31.05.2006 21:48:33 von ermeyers
I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
perl 5.8.8
httpd 2.0.54-10.3
mod_perl 2.0.1-1.fc4
1. If I add the load mod_perl in the perl.conf, the service httpd start
dies.
a) Nothing about the death of httpd in the error_log.
2. I can only get a statically linked perl to run.
a) /usr/bin/perl: error while loading shared libraries: libperl.so:
cannot open shared object file: Permission denied
3. When I try to run a simple CGI.pm program under Apache, with the static
perl, the perl can't find CGI.pm in the @INC paths. Of course, the
script works just fine from the command line.
a) The @INC is correct as shown in the error_log, and CGI.pm didn't
relocate.
Anybody got a clue?
Thanks,
Eric
Re: Problems with Apache 2.0, mod_perl2 and perl
am 31.05.2006 22:03:06 von John Bokma
"Eric R. Meyers" wrote:
> 3. When I try to run a simple CGI.pm program under Apache, with the
> static
> perl, the perl can't find CGI.pm in the @INC paths. Of course, the
> script works just fine from the command line.
>
> a) The @INC is correct as shown in the error_log, and CGI.pm
> didn't
> relocate.
>
> Anybody got a clue?
Is perl allowed to access the CGI.pm file?
Try a simple CGI script that does something like:
print "Content-type: text/plain\n\n";
unless ( open my $fh, "/path/to/CGI.pm" ) {
print "Can't open CGI.pm for reading: $!\n";
exit;
}
print "Could open CGI.pm for reading\n";
I guess you'll get the Can't one.
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
Re: Problems with Apache 2.0, mod_perl2 and perl
am 31.05.2006 22:28:12 von ermeyers
John Bokma wrote:
> print "Content-type: text/plain\n\n";
>
> unless ( open my $fh, "/path/to/CGI.pm" ) {
>
> print "Can't open CGI.pm for reading: $!\n";
> exit;
> }
>
> print "Could open CGI.pm for reading\n";
>
# cat ./helloworld.cgi
#!/usr/bin/perl_static -wT
##
#require CGI::Lite;
print "Content-type: text/html\n\n";
#print "Hello, World.";
unless ( open my $fh, "/usr/lib/perl5/5.8.8/CGI.pm" ) {
print "Can't open CGI.pm for reading: $!\n";
exit;
}
print "Could open CGI.pm for reading\n";
# ./helloworld.cgi
Content-type: text/html
Could open CGI.pm for reading
http://localhost/cgi-bin/helloworld.cgi
Can't open CGI.pm for reading: 13
Re: Problems with Apache 2.0, mod_perl2 and perl
am 31.05.2006 22:36:55 von John Bokma
"Eric R. Meyers" wrote:
> http://localhost/cgi-bin/helloworld.cgi
> Can't open CGI.pm for reading: 13
Yup, so in short: your CGI script is running as a user who has no
permission to read CGI.pm which means that perl can't open the module to
use it.
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
Re: Problems with Apache 2.0, mod_perl2 and perl
am 31.05.2006 22:41:24 von Juha Laiho
"Eric R. Meyers" said:
>I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
....
>2. I can only get a statically linked perl to run.
>
> a) /usr/bin/perl: error while loading shared libraries: libperl.so:
> cannot open shared object file: Permission denied
What are the permissions for libperl.so (and directories above it)?
This could also cause the problems with mod_perl.
>3. When I try to run a simple CGI.pm program under Apache, with the static
> perl, the perl can't find CGI.pm in the @INC paths. Of course, the
> script works just fine from the command line.
Later in thread, you showed that CGI.pm could not be loaded -- again,
what are the permissions fo the file, and directories above it?
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Re: Problems with Apache 2.0, mod_perl2 and perl
am 31.05.2006 22:49:14 von ermeyers
Juha Laiho wrote:
> "Eric R. Meyers" said:
>>I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
> ...
>>2. I can only get a statically linked perl to run.
>>
>> a) /usr/bin/perl: error while loading shared libraries:
>> libperl.so:
>> cannot open shared object file: Permission denied
>
> What are the permissions for libperl.so (and directories above it)?
> This could also cause the problems with mod_perl.
>
>>3. When I try to run a simple CGI.pm program under Apache, with the static
>> perl, the perl can't find CGI.pm in the @INC paths. Of course, the
>> script works just fine from the command line.
>
> Later in thread, you showed that CGI.pm could not be loaded -- again,
> what are the permissions fo the file, and directories above it?
Everything is fine, except under Apache. CGI.pm is 444, or a+r.
Re: Problems with Apache 2.0, mod_perl2 and perl
am 31.05.2006 22:51:51 von ermeyers
John Bokma wrote:
> "Eric R. Meyers" wrote:
>
>> http://localhost/cgi-bin/helloworld.cgi
>> Can't open CGI.pm for reading: 13
>
> Yup, so in short: your CGI script is running as a user who has no
> permission to read CGI.pm which means that perl can't open the module to
> use it.
>
In httpd.conf both User and Group are apache by default, and I changed it to
root, nobody, ermeyers, and nothing seemed to matter. Nice problem huh?
Re: Problems with Apache 2.0, mod_perl2 and perl
am 31.05.2006 23:19:45 von John Bokma
"Eric R. Meyers" wrote:
> John Bokma wrote:
>
>> "Eric R. Meyers" wrote:
>>
>>> http://localhost/cgi-bin/helloworld.cgi
>>> Can't open CGI.pm for reading: 13
>>
>> Yup, so in short: your CGI script is running as a user who has no
>> permission to read CGI.pm which means that perl can't open the module
>> to use it.
>>
>
> In httpd.conf both User and Group are apache by default, and I changed
> it to root, nobody, ermeyers, and nothing seemed to matter. Nice
> problem huh?
But does this make your script run as root (!!!), nobody, etc?
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
Re: Problems with Apache 2.0, mod_perl2 and perl
am 01.06.2006 01:13:02 von ermeyers
John Bokma wrote:
> "Eric R. Meyers" wrote:
>
>> John Bokma wrote:
>>
>>> "Eric R. Meyers" wrote:
>>>
>>>> http://localhost/cgi-bin/helloworld.cgi
>>>> Can't open CGI.pm for reading: 13
>>>
>>> Yup, so in short: your CGI script is running as a user who has no
>>> permission to read CGI.pm which means that perl can't open the module
>>> to use it.
>>>
>>
>> In httpd.conf both User and Group are apache by default, and I changed
>> it to root, nobody, ermeyers, and nothing seemed to matter. Nice
>> problem huh?
>
> But does this make your script run as root (!!!), nobody, etc?
>
I believe so, but it's okay for a one-timer, because root is a close
personal friend of himself. It's back to apache, right now, and I'll use
ps to verify the ug next time I try changing it.
Thanks,
Eric
Re: Problems with Apache 2.0, mod_perl2 and perl
am 01.06.2006 02:13:18 von John Bokma
"Eric R. Meyers" wrote:
> John Bokma wrote:
>
>> "Eric R. Meyers" wrote:
>>
>>> John Bokma wrote:
>>>
>>>> "Eric R. Meyers" wrote:
>>>>
>>>>> http://localhost/cgi-bin/helloworld.cgi
>>>>> Can't open CGI.pm for reading: 13
>>>>
>>>> Yup, so in short: your CGI script is running as a user who has no
>>>> permission to read CGI.pm which means that perl can't open the module
>>>> to use it.
>>>>
>>>
>>> In httpd.conf both User and Group are apache by default, and I changed
>>> it to root, nobody, ermeyers, and nothing seemed to matter. Nice
>>> problem huh?
>>
>> But does this make your script run as root (!!!), nobody, etc?
>>
> I believe so, but it's okay for a one-timer, because root is a close
> personal friend of himself.
But running your scripts as root is certainly not a solution you should
consider. I wouldn't try it, not even on a stand alone box for a one-timer
:-D
> It's back to apache, right now, and I'll use
> ps to verify the ug next time I try changing it.
Perl can do that for you as well.
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
Re: Problems with Apache 2.0, mod_perl2 and perl
am 01.06.2006 06:20:31 von mumia.w.18.spam+nospam.usenet
Eric R. Meyers wrote:
> I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
>
> perl 5.8.8
>
> httpd 2.0.54-10.3
>
> mod_perl 2.0.1-1.fc4
>
> 1. If I add the load mod_perl in the perl.conf, the service httpd start
> dies.
>
> a) Nothing about the death of httpd in the error_log.
>
> 2. I can only get a statically linked perl to run.
>
> a) /usr/bin/perl: error while loading shared libraries: libperl.so:
> cannot open shared object file: Permission denied
> [...]
http://perl.apache.org/docs/2.0/user/troubleshooting/trouble shooting.html#Error_about_not_finding_I_Apache_pm__with_I_CG I_pm_
IOW, upgrade CGI.pm if necessary, but look at the entire troubleshooting
page first.
At one time, the mod_perl docs suggested that using mod_perl as a DSO
under Redhat was a bad idea. You might need a statically linked mod_perl.
Re: Problems with Apache 2.0, mod_perl2 and perl
am 01.06.2006 06:34:10 von ermeyers
Mumia W. wrote:
> Eric R. Meyers wrote:
>> I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
>>
>> perl 5.8.8
>>
>> httpd 2.0.54-10.3
>>
>> mod_perl 2.0.1-1.fc4
>>
>> 1. If I add the load mod_perl in the perl.conf, the service httpd start
>> dies.
>>
>> a) Nothing about the death of httpd in the error_log.
>>
>> 2. I can only get a statically linked perl to run.
>>
>> a) /usr/bin/perl: error while loading shared libraries:
>> libperl.so:
>> cannot open shared object file: Permission denied
>> [...]
>
>
http://perl.apache.org/docs/2.0/user/troubleshooting/trouble shooting.html#Error_about_not_finding_I_Apache_pm__with_I_CG I_pm_
>
> IOW, upgrade CGI.pm if necessary, but look at the entire troubleshooting
> page first.
>
> At one time, the mod_perl docs suggested that using mod_perl as a DSO
> under Redhat was a bad idea. You might need a statically linked mod_perl.
I have the latest $CGI::VERSION='3.20';
I'll concentrate on the mod_perl issue #1.
Thanks,
Eric
Re: Problems with Apache 2.0, mod_perl2 and perl
am 01.06.2006 21:42:45 von Juha Laiho
"Eric R. Meyers" said:
>Juha Laiho wrote:
>
>> "Eric R. Meyers" said:
>>>I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
>> ...
>>>2. I can only get a statically linked perl to run.
>>>
>>> a) /usr/bin/perl: error while loading shared libraries:
>>> libperl.so:
>>> cannot open shared object file: Permission denied
>>
>> What are the permissions for libperl.so (and directories above it)?
>> This could also cause the problems with mod_perl.
>>
>>>3. When I try to run a simple CGI.pm program under Apache, with the static
>>> perl, the perl can't find CGI.pm in the @INC paths. Of course, the
>>> script works just fine from the command line.
>>
>> Later in thread, you showed that CGI.pm could not be loaded -- again,
>> what are the permissions fo the file, and directories above it?
>
>Everything is fine, except under Apache. CGI.pm is 444, or a+r.
If you get "cannot open shared object file: Permission denied",
everything is most definitely not fine. "strace" would be another
tool which might show some additional information on where the
opening of libperl.so fails.
Btw, do you have SELinux, or some other security enchancements
activated? Do you perhaps run Apache chrooted, and the chroot
environment does not include perl installation?
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
Re: Problems with Apache 2.0, mod_perl2 and perl
am 02.06.2006 19:20:45 von Big and Blue
Eric R. Meyers wrote:
> I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
>....
> 2. I can only get a statically linked perl to run.
>
> a) /usr/bin/perl: error while loading shared libraries: libperl.so:
> cannot open shared object file: Permission denied
2) Has nothing to do with mod_perl or Apache. "Permission denied"
sounds as though you've screwed up permissions, since all Perl modules and
libraries should be usable by anyone (except in very special circumstances,
which I doubt obtain here).
--
Just because I've written it doesn't mean that
either you or I have to believe it.
Re: Problems with Apache 2.0, mod_perl2 and perl
am 02.06.2006 21:17:30 von ermeyers
Big and Blue wrote:
> Eric R. Meyers wrote:
>> I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
>>....
>
>> 2. I can only get a statically linked perl to run.
>>
>> a) /usr/bin/perl: error while loading shared libraries:
>> libperl.so:
>> cannot open shared object file: Permission denied
>
> 2) Has nothing to do with mod_perl or Apache. "Permission denied"
> sounds as though you've screwed up permissions, since all Perl modules and
> libraries should be usable by anyone (except in very special
> circumstances, which I doubt obtain here).
>
>
>
>
Not the problem.
Thanks,
Eric
Re: Problems with Apache 2.0, mod_perl2 and perl
am 02.06.2006 21:32:13 von ermeyers
Juha Laiho wrote:
> "Eric R. Meyers" said:
>>Juha Laiho wrote:
>>
>>> "Eric R. Meyers" said:
>>>>I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
>>> ...
>>>>2. I can only get a statically linked perl to run.
>>>>
>>>> a) /usr/bin/perl: error while loading shared libraries:
>>>> libperl.so:
>>>> cannot open shared object file: Permission denied
>>>
>>> What are the permissions for libperl.so (and directories above it)?
>>> This could also cause the problems with mod_perl.
>>>
>>>>3. When I try to run a simple CGI.pm program under Apache, with the
>>>>static
>>>> perl, the perl can't find CGI.pm in the @INC paths. Of course, the
>>>> script works just fine from the command line.
>>>
>>> Later in thread, you showed that CGI.pm could not be loaded -- again,
>>> what are the permissions fo the file, and directories above it?
>>
>>Everything is fine, except under Apache. CGI.pm is 444, or a+r.
>
> If you get "cannot open shared object file: Permission denied",
> everything is most definitely not fine. "strace" would be another
> tool which might show some additional information on where the
> opening of libperl.so fails.
>
> Btw, do you have SELinux, or some other security enchancements
> activated? Do you perhaps run Apache chrooted, and the chroot
> environment does not include perl installation?
I'll look as you've suggested. Good ideas Juha! For everyone else out
there, Perl works just fine outside of trying to run Perl-CGI scripts under
Apache 2.0, or my other problem of trying to load mod_perl2. The
permissions and everthing else are just fine. I'm setup very standard.
I found the problem with not being able to use modules with my static build
of perl. It won't load anything dynamically, because that's how I got a
static build, because I turned off dynamic loading. I'd have to build it
by linking-in every module that I'd want to use in a CGI program. Nope.
Thanks,
Eric
Eric
Re: Problems with Apache 2.0, mod_perl2 and perl
am 02.06.2006 22:26:07 von ermeyers
Juha Laiho wrote:
> "Eric R. Meyers" said:
>>Juha Laiho wrote:
>>
>>> "Eric R. Meyers" said:
>>>>I'm using FC4 Linux, and I'm having some problems with Apache 2.0.
>>> ...
>>>>2. I can only get a statically linked perl to run.
>>>>
>>>> a) /usr/bin/perl: error while loading shared libraries:
>>>> libperl.so:
>>>> cannot open shared object file: Permission denied
>>>
>>> What are the permissions for libperl.so (and directories above it)?
>>> This could also cause the problems with mod_perl.
>>>
>>>>3. When I try to run a simple CGI.pm program under Apache, with the
>>>>static
>>>> perl, the perl can't find CGI.pm in the @INC paths. Of course, the
>>>> script works just fine from the command line.
>>>
>>> Later in thread, you showed that CGI.pm could not be loaded -- again,
>>> what are the permissions fo the file, and directories above it?
>>
>>Everything is fine, except under Apache. CGI.pm is 444, or a+r.
>
> If you get "cannot open shared object file: Permission denied",
> everything is most definitely not fine. "strace" would be another
> tool which might show some additional information on where the
> opening of libperl.so fails.
>
> Btw, do you have SELinux, or some other security enchancements
> activated? Do you perhaps run Apache chrooted, and the chroot
> environment does not include perl installation?
And the ANSWER was SELinux! Perl-CGI scripts immediately worked when I
checked "Disable SELinux protection for httpd daemon" in the
system-config-securitylevel utility.
Thanks very much Juha,
Eric