Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

mod_perl on apache works when symlinked to one directory but not to another

by Cody Fendant (Friar)
on Nov 28, 2020 at 03:43 UTC ( #11124304=perlquestion: print w/replies, xml ) Need Help??

Cody Fendant has asked for the wisdom of the Perl Monks concerning the following question:

This is kind of an embarrassing one. I'm sure I must be missing something obvious.

I have a Catalyst based website running in mod_perl.

There are two versions of the website, let's call them old and new (new was cloned from a remote git repo to the server, could that be causing the problem?)

  • The website works when the directory /var/www is symlinked to old, as in

    ln -s /path/to/old /var/www

  • The website does not work when the directory /var/www is symlinked to new, as in

    ln -s /path/to/new /var/www
    (removing the old link first of course).

The reason it doesn't work, seen in apache error logs, is that it can't find the custom perl modules in /path/to/new. It says it can't find them in @INC and that @INC contains /var/www and /var/www/whatever/lib/Module/etc which is correct

When I remove that symlink and re-link /path/to/old it works just fine.

If I do perl -I/path/to/new -MSome::Module::In::New there's no problem, it finds the module just fine.

I've checked permissions and made sure they're the same, or even less restrictive on the files in /path/to/new. The relative paths are all correct, as far as I can see my /path/to/old and /path/to/new directories are exactly the same, except that apache/mod_perl can see one and not the other.

This is on an Amazon EC2 running linux by the way.

Replies are listed 'Best First'.
Re: mod_perl on apache works when symlinked to one directory but not to another
by alexander_lunev (Pilgrim) on Nov 28, 2020 at 09:01 UTC
    Just to make sure - did you restart Apache after relinking?

      Good point but yes, I restarted. Because it's mod_perl I don't even see errors until I restart.

Re: mod_perl on apache works when symlinked to one directory but not to another
by hippo (Chancellor) on Nov 28, 2020 at 10:41 UTC

    Did you check the audit log and/or the contexts on /path/to/new?


      Hi, I'm not sure what either of those means. I'm checking the Apache error log, but I don't know if that's what you mean about by 'audit log', or 'contexts'.

        By "contexts" I was referring to the SELinux security contexts. If these are wrong then the mod_perl process may not be able to search the paths in order to find the modules. In that case the failed attempt would be logged in the audit log which is usually /var/log/audit/audit.log.


A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11124304]
Front-paged by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2021-01-27 11:24 GMT
Find Nodes?
    Voting Booth?