Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

.htaccess for Locating Locally Installed Perl

by monkfan (Curate)
on Mar 28, 2007 at 06:22 UTC ( #606917=perlquestion: print w/replies, xml ) Need Help??
monkfan has asked for the wisdom of the Perl Monks concerning the following question:

Dear fellow monks, I've installed Perl interpreter in my local directory as follows:
$!which perl /home/rsch/bioinfo/.perl/bin/perl
And I also have stored the .htaccess with the following entries:
SetEnv PATH /home/rsch/bioinfo/.perl/bin:/home/rsch/bioinfo/bin SetEnv PERL5LIB /home/rsch/bioinfo/lib/perl5/site_perl/5.8.7/sun4-sola +ris:/home/rsch/bioinfo/lib/perl5/site_perl/5.8.7
However upon running my cgi-script (hello.cgi) like this:
#!/home/rsch/bioinfo/.perl/bin/perl print "Content-type: text/html\n\n"; print "Hello World !! It works.\n";
It gives the following error log. /home/rsch/bioinfo/.perl/bin/perl: fatal: version +`SUNW_1.19' not found (required by file /home/rsch/bioinfo/.perl/bin/ +perl)
Any idea what went wrong with my scheme? Especially the .htaccess entry?

Some notes:
  • The default (#!/usr/local/bin/perl) Perl version in my office system is too old (version 5.004). That's why I installed the latest version of Perl locally.
  • I can execute a normal perl script (*.pl) with my locally installed perl with no problem with the new shebang (#!/home/rsch/bioinfo/.perl/bin/perl).


Replies are listed 'Best First'.
Re: .htaccess for Locating Locally Installed Perl
by almut (Canon) on Mar 28, 2007 at 10:03 UTC

    You say you can run your locally installed perl normally outside of the webserver context. So you could check which it is using in this case:

    $ ldd -s /home/rsch/bioinfo/.perl/bin/perl

    In the output, you'll see a paragraph beginning with find Something like this:

    find; required by /usr/local/bin/perl search path=/usr/local/lib (RPATH from file /usr/local/bin/perl) trying path=/usr/local/lib/ search path=/usr/lib (default) trying path=/usr/lib/ => /usr/lib/

    Or, with LD_LIBRARY_PATH set:

    find; required by /usr/local/bin/perl search path=/opt/SUNWits/Graphics-sw/xil/lib:/usr/openwin/lib:/opt +/SUNWits/Graphics-sw/xgl/lib:/usr/dt/lib:/usr/openwin/lib:/usr/local/ +lib:/usr/lib:/usr/ucblib (LD_LIBRARY_PATH) trying path=/opt/SUNWits/Graphics-sw/xil/lib/ trying path=/usr/openwin/lib/ trying path=/opt/SUNWits/Graphics-sw/xgl/lib/ trying path=/usr/dt/lib/ trying path=/usr/openwin/lib/ trying path=/usr/local/lib/ trying path=/usr/lib/ => /usr/lib/

    Essentially, this tells you that has been found in /usr/lib/ (in my case). You can then add that directory to the shared object search path LD_LIBRARY_PATH in your CGI environment, just like you're already setting PERL5LIB.

    (Report back what you get from ldd, ldd -s and ldd -sv, in case this doesn't help...)

Re: .htaccess for Locating Locally Installed Perl
by johngg (Abbot) on Mar 28, 2007 at 09:00 UTC
    Run this command line snippet and check whether the paths shown agree with your $PERL5LIB environment variable. It looks to me if you might have a discrepancy somewhere; /home/rsch/bioinfo/.perl/bin vs. /home/rsch/bioinfo/lib/perl5.

    perl -le 'print for @INC;'

    I hope this helps.



      Hi johngg,
      Following your suggestion here is what I have:
      bioinfo@sf3:~[505]$ perl -le 'print for @INC;' /home/rsch/bioinfo/lib/perl5/site_perl/5.8.7/sun4-solaris /home/rsch/bioinfo/lib/perl5/site_perl/5.8.7 /home/rsch/bioinfo/.perl/lib/5.8.7/sun4-solaris /home/rsch/bioinfo/.perl/lib/5.8.7 /home/rsch/bioinfo/.perl/lib/site_perl/5.8.7/sun4-solaris /home/rsch/bioinfo/.perl/lib/site_perl/5.8.7 /home/rsch/bioinfo/.perl/lib/site_perl .

Re: .htaccess for Locating Locally Installed Perl
by Anno (Deacon) on Mar 28, 2007 at 08:58 UTC
    Check the environment with an eye on variables that influence dynamic loading.

    Print the environment (printenv) from the CGI script and interactively and find the differences. Quite a few differences will have nothing to do with your problem, but some may.


      Hi Anno,
      Running printenv give me this.
      $ printenv PWD=/home/rsch/bioinfo TZ=Singapore bashrc_already_invoked=true SCREENDIR=/home/rsch/bioinfo/.screen LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/usr/local/openwin/lib:/usr/op +enwin/lib:/usr/X11/lib://opt/sfw/gcc-3/lib:/opt/sfw/lib:/opt/parasoft +/lib.solaris:/opt/SUNWmotif/lib:/usr/dt/lib:/usr/ccs/lib PARASOFT=/opt/parasoft PERL5LIB=/home/rsch/bioinfo/lib/perl5/site_perl/5.8.7/sun4-solaris:/ho +me/rsch/bioinfo/lib/perl5/site_perl/5.8.7 OPENWINHOME=/usr/openwin TERMINFO=/usr/local/share/terminfo MANPATH=/opt/SUNWspro/man:/usr/dt/man:/usr/local/.5.8/man:/usr/local/m +an:/usr/local/teTeX/man:/usr/local/tex/man:/usr/man:/usr/local/interv +iews/man:/usr/local/openwin/man:/usr/openwin/share/man:/usr/local/X11 +/lman:/usr/X11/man:/opt/sfw/gcc-3/man:/opt/sfw/man H_SPELL=/tmp/spellhist.bioinfo USER=bioinfo AB_CARDCATALOG=/usr/local/lib/ab_cardcatalog OLDPWD=/ MAIL=/var/spool/mail/bioinfo/bioinfo EDITOR=vim SSH_CLIENT= 1517 22 LOGNAME=bioinfo SHLVL=1 SSH_CONNECTION= 1517 22 SHELL=/bin/bash CPU=SUN4 HOME=/home/rsch/bioinfo TERM=vt100 PATH=/home/rsch/bioinfo/.perl/bin:/home/rsch/bioinfo/bin:/opt/SUNWspro +/bin:/home/rsch/bioinfo/bin/SUN4:/local/bin:/usr/local/.5.8/bin:/usr/ +local/bin:/usr/bin:/usr/ucb:/usr/local/java/jdk/bin:/usr/local/teTeX/ +bin:/usr/local/teTeX/bin/sparc-sun-solaris2.8:/usr/local/tex/bin:/usr +/local/interviews/bin/SUN4:/usr/local/openwin/bin:/usr/openwin/bin:/u +sr/local/X11/bin:/usr/X11/bin:/opt/sfw/gcc-3/bin:/opt/sfw/bin:/usr/lo +cal/share/oracle:/usr/dt/bin:/opt/SUNWmfwm/bin:/usr/ccs/bin:. XAPPLRESDIR=/usr/local/X11/lib/X11/app-defaults SSH_TTY=/dev/pts/41 _=/usr/ucb/printenv
      It seems that my .htaccess entry already accordance with it.

      Update: all the complete variables included, following Anno's suggestion.
        There is little to be said looking at only one set of environment variables. Is that your normal interactive environment or what your CGI scripts see? With only three variables set, it looks unusually meager.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://606917]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2018-07-19 18:00 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (414 votes). Check out past polls.