niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » Perl » modules
Problems with Apache 2.0, mod_perl2 and perl
Post new topic   Reply to topic Page 1 of 2 [17 Posts] View previous topic :: View next topic
Goto page:  1, 2 Next
Author Message
John Bokma
*nix forums Guru


Joined: 23 Feb 2005
Posts: 1136

PostPosted: Wed May 31, 2006 8:03 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

"Eric R. Meyers" <ermeyers@adelphia.net> wrote:

Quote:
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/
Back to top
Eric R. Meyers
*nix forums addict


Joined: 10 May 2006
Posts: 63

PostPosted: Wed May 31, 2006 8:28 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

John Bokma wrote:

Quote:
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
Back to top
John Bokma
*nix forums Guru


Joined: 23 Feb 2005
Posts: 1136

PostPosted: Wed May 31, 2006 8:36 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

"Eric R. Meyers" <ermeyers@adelphia.net> wrote:

Quote:
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/
Back to top
Juha Laiho
*nix forums Guru Wannabe


Joined: 22 Feb 2005
Posts: 139

PostPosted: Wed May 31, 2006 8:41 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

"Eric R. Meyers" <ermeyers@adelphia.net> said:
Quote:
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.

Quote:
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)
Back to top
Eric R. Meyers
*nix forums addict


Joined: 10 May 2006
Posts: 63

PostPosted: Wed May 31, 2006 8:49 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

Juha Laiho wrote:

Quote:
"Eric R. Meyers" <ermeyers@adelphia.net> 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.
Back to top
Eric R. Meyers
*nix forums addict


Joined: 10 May 2006
Posts: 63

PostPosted: Wed May 31, 2006 8:51 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

John Bokma wrote:

Quote:
"Eric R. Meyers" <ermeyers@adelphia.net> 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?
Back to top
John Bokma
*nix forums Guru


Joined: 23 Feb 2005
Posts: 1136

PostPosted: Wed May 31, 2006 9:19 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

"Eric R. Meyers" <ermeyers@adelphia.net> wrote:

Quote:
John Bokma wrote:

"Eric R. Meyers" <ermeyers@adelphia.net> 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/
Back to top
Eric R. Meyers
*nix forums addict


Joined: 10 May 2006
Posts: 63

PostPosted: Wed May 31, 2006 11:13 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

John Bokma wrote:

Quote:
"Eric R. Meyers" <ermeyers@adelphia.net> wrote:

John Bokma wrote:

"Eric R. Meyers" <ermeyers@adelphia.net> 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
Back to top
John Bokma
*nix forums Guru


Joined: 23 Feb 2005
Posts: 1136

PostPosted: Thu Jun 01, 2006 12:13 am    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

"Eric R. Meyers" <ermeyers@adelphia.net> wrote:

Quote:
John Bokma wrote:

"Eric R. Meyers" <ermeyers@adelphia.net> wrote:

John Bokma wrote:

"Eric R. Meyers" <ermeyers@adelphia.net> 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

Quote:
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/
Back to top
Mumia W.
*nix forums Guru Wannabe


Joined: 08 May 2006
Posts: 153

PostPosted: Thu Jun 01, 2006 4:20 am    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

Eric R. Meyers wrote:
Quote:
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/troubleshooting.html#Error_about_not_finding_I_Apache_pm__with_I_CGI_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.
Back to top
Eric R. Meyers
*nix forums addict


Joined: 10 May 2006
Posts: 63

PostPosted: Thu Jun 01, 2006 4:34 am    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

Mumia W. wrote:

Quote:
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/troubleshooting.html#Error_about_not_finding_I_Apache_pm__with_I_CGI_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
Back to top
Juha Laiho
*nix forums Guru Wannabe


Joined: 22 Feb 2005
Posts: 139

PostPosted: Thu Jun 01, 2006 7:42 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

"Eric R. Meyers" <ermeyers@adelphia.net> said:
Quote:
Juha Laiho wrote:

"Eric R. Meyers" <ermeyers@adelphia.net> 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)
Back to top
Big and Blue
*nix forums addict


Joined: 21 Feb 2005
Posts: 95

PostPosted: Fri Jun 02, 2006 5:20 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

Eric R. Meyers wrote:
Quote:
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.
Back to top
Eric R. Meyers
*nix forums addict


Joined: 10 May 2006
Posts: 63

PostPosted: Fri Jun 02, 2006 7:17 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

Big and Blue wrote:

Quote:
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
Back to top
Eric R. Meyers
*nix forums addict


Joined: 10 May 2006
Posts: 63

PostPosted: Fri Jun 02, 2006 7:32 pm    Post subject: Re: Problems with Apache 2.0, mod_perl2 and perl Reply with quote

Juha Laiho wrote:

Quote:
"Eric R. Meyers" <ermeyers@adelphia.net> said:
Juha Laiho wrote:

"Eric R. Meyers" <ermeyers@adelphia.net> 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
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 2 [17 Posts] Goto page:  1, 2 Next
View previous topic :: View next topic
The time now is Fri Jan 09, 2009 5:03 am | All times are GMT
navigation Forum index » Programming » Perl » modules
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Winbind problems for ADS authentication nlinley networking 1 Tue Sep 19, 2006 9:22 am
No new posts Need Help with Program in Perl on a Netware Server fhadzocos@gmail.com Perl 3 Fri Jul 21, 2006 1:57 pm
No new posts problems using oddmuse with mod_perl2 inside apache2.2 pe... Fergus McMenemie Perl 0 Fri Jul 21, 2006 9:48 am
No new posts Problem with Win32-SerialPort over bluetooth @ windows + ... ctloh Perl 0 Fri Jul 21, 2006 8:08 am
No new posts Posting Guidelines for comp.lang.perl.misc (: 1.... Tad McClellan Perl 0 Fri Jul 21, 2006 7:22 am

Vietnamese Magazine | Mortgage Calculator | Credit Cards | Mobile Phone | Mortgages
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2836s ][ Queries: 16 (0.1488s) ][ GZIP on - Debug on ]