Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Catlyst, Apache and local CPAN installations

by tospo (Hermit)
on May 30, 2012 at 10:31 UTC ( #973248=perlmeditation: print w/ replies, xml ) Need Help??

Just wanted to post this here because it took me some time to figure it out and couldn't find much about this elsewhere.

I had some problems trying to deploy a Catalyst app on a server where my CPAN (and my own modules) are installed in a local directory handled by local::lib.
I use Apache2 and the app runs as a cluster of FastCGI processes (static setup). Altough the user who runs Apache has the PERL5LIB properly set up in a login shell, somehow Apache didn't see this setting. Turns out that Apache deliberately ignores the PERL5LIB unless you explicitly tell it to use it with a PassEnv directive.
In addition, you also need to pass the PERL5LIB path through to the acutal FastCGI processes so that they are started up in the correct environment. You do that with the -initial-env option to the FastCgiServer directive.
All in all, you should have something like this in the config file for the site:

<VirtualHost *:*> [... YOUR USUAL CONFIG STUFF HERE ] # tell Apache to use the PERL5LIB PassEnv PERL5LIB # pass it on to the fastcgi processes that Apache will # start up for us (3 in this case) FastCgiServer /PATH/TO/my_app_fastcgi.pl -processes 3 -initial-env P +ERL5LIB </VirtualHost>
The PERL5LIB is setup in the bash profile for the user who runs Apache in my case (using local::lib). You could also substitute PERL5LIB for an explicit path in the above code snippet.

Comment on Catlyst, Apache and local CPAN installations
Download Code
Reaped: Re: Catlyst, Apache and local CPAN installations
by NodeReaper (Curate) on Jun 02, 2012 at 03:16 UTC
Reaped: Re: Catlyst, Apache and local CPAN installations
by NodeReaper (Curate) on Jun 02, 2012 at 13:00 UTC
Reaped: Re: Catlyst, Apache and local CPAN installations
by NodeReaper (Curate) on Jun 03, 2012 at 12:30 UTC
Reaped: Re: Catlyst, Apache and local CPAN installations
by NodeReaper (Curate) on Jun 05, 2012 at 12:44 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://973248]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-10-31 04:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (214 votes), past polls