LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-27-2016, 02:06 PM   #1
Likeless
LQ Newbie
 
Registered: May 2009
Posts: 21

Rep: Reputation: 0
Trying to add CPAN Perl Modules to mod_perl on Apache CentOS 7


I am running Apache on Centos 7.

Some of the Perl modules that were not available via yum I have installed using CPAN in the custom location /export/home/www/perl5. I have used this custom location specifically to prevent the CPAN modules from interfering with anything installed by yum, or vice versa.

I then put this in my .bashrc:
Code:
export PERL_LOCAL_LIB_ROOT="$PERL_LOCAL_LIB_ROOT:/export/home/www/perl5";
export PERL_MB_OPT="--install_base /export/home/www/perl5";
export PERL_MM_OPT="INSTALL_BASE=/export/home/www/perl5";
export PERL5LIB="/export/home/www/perl5/lib/perl5:$PERL5LIB";
export PATH="/export/home/www/perl5/bin:$PATH";
That worked great for running a locally built Apache, but when I try to run the Apache2 that comes with yum, I get this:
Code:
[Mon Jun 27 19:35:34.099272 2016] [perl:error] [pid 29077] Can't locate Apache/DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /etc/httpd) at (eval 3) line 2.\n
So the custom path has not been added to @INC for this Apache. I assume it isn't running from within my shell.

How do I get Apache to add this perl path?
 
Old 06-28-2016, 06:17 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Cleanest is to explicitly set the variables in the Apache config using setenv.
 
Old 06-28-2016, 07:53 AM   #3
Likeless
LQ Newbie
 
Registered: May 2009
Posts: 21

Original Poster
Rep: Reputation: 0
Unfortunately you cannot modify the PATH variable with SetEnv.
 
Old 06-28-2016, 12:02 PM   #4
Likeless
LQ Newbie
 
Registered: May 2009
Posts: 21

Original Poster
Rep: Reputation: 0
Question

Okay, I made some progress by editing the file /etc/sysconfig/httpd

It says that it is the place to modify the Apache environment. I have added this:

Code:
PERL_LOCAL_LIB_ROOT="/export/home/www/perl5"                        
PERL_MB_OPT="--install_base /export/home/www/perl5" 
PERL_MM_OPT="INSTALL_BASE=/export/home/www/perl5" 
PERL5LIB="/export/home/www/perl5/lib/perl5"             
PATH="/export/home/www/perl5/bin:$PATH"
The server now starts, but when I examine the environment variables I see this:
Code:
PATH	/export/home/www/perl5/bin:$PATH
What I really want to see is this, though:
Code:
PATH	/export/home/www/perl5/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Presumably I'm just using the wrong syntax. I've played around with some versions, but I just keep getting the literally quoted PATH variable name. Doees anyone know how to get it interpolated?
 
Old 06-29-2016, 04:57 PM   #5
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Here are various other opinions:
http://serverfault.com/questions/151...nment-variable
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about CPAN and perl modules circus78 Linux - Server 1 02-12-2013 06:27 PM
issues with cpan perl modules reticent Debian 12 01-29-2011 07:30 AM
CPAN and PERL Modules metallica1973 Programming 4 02-01-2008 09:14 PM
load perl CPAN modules sailu_mvn Linux - Software 1 04-18-2006 07:31 PM
Canīt download perl modules with cpan emilioestevezz Linux - Networking 1 08-25-2004 09:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration