Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: apache 2.4 mod_perl permission denied on standard modules

by 1nickt (Canon)
on Aug 28, 2015 at 19:29 UTC ( #1140372=note: print w/replies, xml ) Need Help??


in reply to apache 2.4 mod_perl permission denied on standard modules

Can't locate Digest/SHA.pm: Permission denied
I would look at what user Apache is running as, and what the file permissions are on your Perl library directories.

The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: apache 2.4 mod_perl permission denied on standard modules
by Crackers2 (Parson) on Aug 28, 2015 at 19:51 UTC

    Runs under a dedicated user; if I su to that user I can read the modules in question without issue, and a perl -e'use MyHandler' as that user works fine as well.

    If I add a block like this:

    use warnings; BEGIN { open my $fh, ">>", "/tmp/x"; print $fh "@INC\n"; open my $in, "<", "/usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/D +igest/SHA.pm"; while (<$in>) { print $fh $_; } close $in; close $fh; } use Apache2::Const qw(:common); use Digest::SHA qw(sha256_hex sha1_hex);

    then /tmp/x ends up with:

    /etc/apache2/script /srv/www/perl-lib /usr/lib/perl5/site_perl/5.18.2/ +x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.18.2 /usr/lib/pe +rl5/vendor_perl/5.18.2/x86_64-linux-thread-multi /usr/lib/perl5/vendo +r_perl/5.18.2 /usr/lib/perl5/5.18.2/x86_64-linux-thread-multi /usr/li +b/perl5/5.18.2 /usr/lib/perl5/site_perl . /srv/www package Digest::SHA; require 5.003000; use strict; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); use Fcntl; use integer; $VERSION = '5.84_01'; require Exporter; require DynaLoader; @ISA = qw(Exporter DynaLoader); @EXPORT_OK = qw( hmac_sha1 hmac_sha1_base64 hmac_sha1_hex ...

    So the script can definitely read the file.

      Is there another copy of the module in a directory (with different file permissions) that is earlier in @INC than the one you read in your test script?

      The way forward always starts with a minimal test.

        Nope, no copies of Digest/SHA.pm anywhere else

        If I manually add

        require "/usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/Digest/SHA.pm +";

        in a BEGIN block, the error in the apache log changes to:

        Can't locate Fcntl.pm: Permission denied at /usr/lib/perl5/5.18.2/x +86_64-linux-thread-multi/Digest/SHA.pm line 7.

        If I also add an explicit

        use lib '/usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/'

        It ends up with:

        Can't locate integer.pm: Permission denied at /usr/lib/perl5/5.18.2/ +x86_64-linux-thread-multi/Digest/SHA.pm line 8

        With this BEGIN block:

        BEGIN { foreach (@INC) { use lib $_; } }

        which I think should be pretty much a noop (I also tried with reverse @inc, same result) I end up with:

        Can't locate Carp.pm: Permission denied at /usr/lib/perl5/5.18.2/x86 +_64-linux-thread-multi/lib.pm line 25

        And of course Carp.pm is there

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1140372]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-11-29 01:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?