Problems with Apache 2.0, mod_perl2 and perl

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default Problems with Apache 2.0, mod_perl2 and perl

    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
    Eric R. Meyers Guest

  2. Similar Questions and Discussions

    1. Mason Mod_Perl2.0 Apache 2.0 Fedora Core 1 AMD64 - HOW I DID IT! -
      Here's how I got Mason to work with Apache 2.0 In short, 1. get Mason 2. get libapreq2-2.04-dev 3. get mod_perl-2.0-current.tar.gz
    2. apache::dbi & mod_perl2
      Hello, Can I still use apache::dbi with apache2/mod_perl2 ?? (it is not in the list of the ported module yet) Should I use something else for...
    3. perl and/und apache
      attempt to invoke directory as script: c:/foxserv/www/cgi-bin This is standing in error.log Apache. Das steht in error.log Apache. And I get:...
    4. mod_php 4.3.2 (w/ apache 2.0.40 using apache filters) - problems loading extensions
      (cross posted from php.install in hopes of increasing my chances of finding help) I've been trying to get php working on our RH8 box using a...
    5. #13024 [Com]: Problems with PHP on Apache .. when loading php script a few times Apache crash
      ID: 13024 Comment by: javri28 at hotmail dot com Reported By: j_barrancos at hotmail dot com Status: Bogus Bug...
  3. #2

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    "Eric R. Meyers" <ermeyers@adelphia.net> 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: [url]http://castleamber.com/[/url]
    John Bokma Guest

  4. #3

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    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

    [url]http://localhost/cgi-bin/helloworld.cgi[/url]
    Can't open CGI.pm for reading: 13

    Eric R. Meyers Guest

  5. #4

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    > [url]http://localhost/cgi-bin/helloworld.cgi[/url]
    > 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: [url]http://castleamber.com/[/url]
    John Bokma Guest

  6. #5

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    "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?
    --
    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)
    Juha Laiho Guest

  7. #6

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    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.

    Eric R. Meyers Guest

  8. #7

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    John Bokma wrote:
    > "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    >
    >> [url]http://localhost/cgi-bin/helloworld.cgi[/url]
    >> 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?

    Eric R. Meyers Guest

  9. #8

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    > John Bokma wrote:
    >
    >> "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    >>
    >>> [url]http://localhost/cgi-bin/helloworld.cgi[/url]
    >>> 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: [url]http://castleamber.com/[/url]
    John Bokma Guest

  10. #9

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    John Bokma wrote:
    > "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    >
    >> John Bokma wrote:
    >>
    >>> "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    >>>
    >>>> [url]http://localhost/cgi-bin/helloworld.cgi[/url]
    >>>> 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

    Eric R. Meyers Guest

  11. #10

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    > John Bokma wrote:
    >
    >> "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    >>
    >>> John Bokma wrote:
    >>>
    >>>> "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
    >>>>
    >>>>> [url]http://localhost/cgi-bin/helloworld.cgi[/url]
    >>>>> 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: [url]http://castleamber.com/[/url]
    John Bokma Guest

  12. #11

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    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
    > [...]
    [url]http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html#Error_about_not_finding_I_Apa che_pm__with_I_CGI_pm_[/url]

    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.


    Mumia W. Guest

  13. #12

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    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
    >> [...]
    >
    >
    [url]http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html#Error_about_not_finding_I_Apa che_pm__with_I_CGI_pm_[/url]
    >
    > 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
    Eric R. Meyers Guest

  14. #13

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    "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?
    --
    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)
    Juha Laiho Guest

  15. #14

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    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.
    Big and Blue Guest

  16. #15

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    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
    Eric R. Meyers Guest

  17. #16

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    Juha Laiho wrote:
    > "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
    Eric R. Meyers Guest

  18. #17

    Default Re: Problems with Apache 2.0, mod_perl2 and perl

    Juha Laiho wrote:
    > "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?
    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
    Eric R. Meyers Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139