Problem with .htaccess and PERL5LIB


#1

One of my websites uses a bunch of perl modules installed with cpan to ~/perlmods
I have been useing a .htaccess file to set PERL5LIB:
SetEnv PERL5LIB /home/wildlifedb/perlmods/lib/perl/5.10.0/:/home/wildlifedb/perlmods/share/perl/5.10.0/

For some reason this stopped working yesterday, I have not made any changes to the code for months and yesterday it stopped working and started generating the following error:
[Thu May 10 18:33:08 2012] [error] [client 69.20.186.122] Can’t locate Petal.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at index.pl line 4.
[Thu May 10 18:33:08 2012] [error] [client 69.20.186.122] BEGIN failed–compilation aborted at index.pl line 4.
[Thu May 10 18:33:08 2012] [error] [client 69.20.186.122] Premature end of script headers: index.pl

It looks like the .htaccess is no longer getting read.


#2

More likely suexec isn’t passing on PERL5LIB


#3

I’m not too savvy with Perl, but with PHP, you can set those paths in the script itself. Perhaps try that?


#4

Yeah, that’s what I’m doing for now, but for an app with 30+ files deployed in multiple environments under version control this is not a viable long term solution.

Re: suExec
That does seem like it could be what’s going on, but from what I’ve read it shouldn’t have ever worked. Maybe dreamhost was using a custom version of suExec that did pass perl5lib and just updated to a version that doesn’t?


#5

That is, in fact, exactly what happened.


#6

Any suggestions for a workaround other than specifying the library path in each file?


#7

I’m thinking some kind of wrapper, ie perl.sh that sets PERL5LIB first, but then you have to have that in your shebang line, which wouldn’t match what you might have for your local development machine.