Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

.htaccess for Locating Locally Installed Perl

by monkfan (Curate)
on Mar 28, 2007 at 06:22 UTC ( [id://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.
ld.so.1: /home/rsch/bioinfo/.perl/bin/perl: fatal: libc.so.1: 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).

Regards,
Edward

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 libc.so 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 object=libc.so.1. Something like this:

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

    Or, with LD_LIBRARY_PATH set:

    find object=libc.so.1; 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/libc.so.1 trying path=/usr/openwin/lib/libc.so.1 trying path=/opt/SUNWits/Graphics-sw/xgl/lib/libc.so.1 trying path=/usr/dt/lib/libc.so.1 trying path=/usr/openwin/lib/libc.so.1 trying path=/usr/local/lib/libc.so.1 trying path=/usr/lib/libc.so.1 libc.so.1 => /usr/lib/libc.so.1

    Essentially, this tells you that libc.so 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 (Canon) 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.

    Cheers,

    JohnGG

      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 .

      Regards,
      Edward
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.

    Anno

      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=137.132.80.55 1517 22 LOGNAME=bioinfo SHLVL=1 SSH_CONNECTION=137.132.80.55 1517 137.132.90.55 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.
      Regards,
      Edward
        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.

        Anno

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://606917]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-03-19 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found