Connecting Tech Pros Worldwide Help | Site Map

Perl and Apache

Newbie
 
Join Date: Oct 2008
Location: Cyprus
Posts: 3
#1: Oct 23 '08
I have a perl script that runs perfectly when i run from the command prompt.
When I execute via apache2 it does NOT run because it cannot locate region.pm which i need for the script. region.pm is in the same folder as the script.
when i remove it it works.
It also works when i include "use lib 'script_folder';" !

I believe it has to do with apache and paths.
The apache error log gives message "Can't locate region.pm in @INC".
I have added the path to @INC but still doesn't work!

Any Ideas?????
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,565
#2: Oct 23 '08

re: Perl and Apache


Do you add the directory where the script is located into your @INC?

@INC contains the list of directories where Perl will look for installed modules. If you have your own, then you are going to have to add, in your script, the directory where your perl module is being kept.

Here is a link that shows you what I am talking about.

Regards,

Jeff
Newbie
 
Join Date: Oct 2008
Location: Cyprus
Posts: 3
#3: Oct 24 '08

re: Perl and Apache


Thanks Jef

/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/ 5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-m ulti /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_ perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/li b/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8. 8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-mul ti /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendo r_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/p erl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_pe rl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 . /data1/flystaydrive/rois

here are paths in @INC and the last one /data1/flystaydrive/rois is the path where both the perl script and region.pm are located
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,565
#4: Oct 24 '08

re: Perl and Apache


If it is in the @INC path, then you need to make sure that other factors, like permissions on that directory or the modules are not keeping you from accessing them.

Regards,

Jeff
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#5: Oct 24 '08

re: Perl and Apache


see post below
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#6: Oct 24 '08

re: Perl and Apache


I think the problem is that the "lib" folder is outside of the apache folder. Not sure if Apache will include a folder from just anywhere on the hard drive. Move the folder and the script into the apache folder and retry.
Newbie
 
Join Date: Oct 2008
Location: Cyprus
Posts: 3
#7: Oct 30 '08

re: Perl and Apache


Quote:

Originally Posted by KevinADC

I think the problem is that the "lib" folder is outside of the apache folder. Not sure if Apache will include a folder from just anywhere on the hard drive. Move the folder and the script into the apache folder and retry.

I believe that the problem lies with apache and not perl! I have another linux server and I have tried it and it works as it is! I will try and reinstall apache.
Reply