in reply to Re: Re: Problems with environment variables.
in thread Problems with environment variables.

First, you should find all the executables on your system named perl. The most likely places are /usr/bin/perl and /usr/local/bin/perl. Check the directories in your path (`echo $PATH`) for other executables named perl. (If you're on Linux, you could use `locate` to find any outside your path. `locate -r /perl\$` [This will find directories named perl also.])

Once you've found all the perl executables, check their versions. /usr/bin/perl -v will tell you the version of the perl executable in /usr/bin; usr/bin/perl -V will tell you the configuration details as well, including the values in @INC. Figure out which executable is the right version and points to the right directories in @INC.

When you find the perl you want to use, let's say /usr/local/bin/perl, you probably want to rename the others. For example, if /usr/local/bin/perl is 5.6.1, and /usr/bin/perl is 5.6.0, rename /usr/bin/perl to perl5.6.0, and replace it with a link to the main perl: `ln -s /usr/local/bin/perl /usr/bin/perl`. However, you should make sure that scripts using /usr/bin/perl will continue to work after the switch to /usr/local/bin/perl. You can skip this step if you're unsure.

Now that you know you want to use /usr/local/bin/perl with the specific script that started this process, open the script in your editor and make sure the first line in #!/usr/local/bin/perl. If it's a web script, make sure your server is configured to use /usr/local/bin/perl to execute Perl scripts.

I hope that's helpful!

  • Comment on Re: Re: Re: Problems with environment variables.

Replies are listed 'Best First'.
Re: Re: Re: Re: Problems with environment variables.
by Anonymous Monk on Aug 16, 2001 at 22:54 UTC
    Wow, that was incredibly helpful. I just have one last question though: If I have a link '/usr/bin/perl' that points to '/usr/local/bin/perl'. Why would I have to change my httpd.conf? Since it would still be pointing to /usr/bin/perl, wouldn't it just follow the link?

    Thanks again, Brian

      You're absolutely right. If you set up the link from /usr/bin/perl to /usr/local/bin/perl, then you can leave all your scripts and your httpd.conf referring to /usr/bin/perl.
        Hmmm, well now I'm rather perplexed. I have 4 perl binaries on my system:

        /usr/bin/perl,
        /usr/bin/perl5.6.0,
        /usr/local/bin/perl,
        and /usr/local/bin/perl5.6.1

        Now the perl files are the same size in each respective directory (I made sure, using 'diff'). I then removed /usr/bin/perl (since I still had the perl5.6.0 binary as a backup) and replaced it with a link to /usr/local/bin/perl. I verify that it was functioning properly by running 'perl -v' and it now tells me that it is version 5.6.1 AND when I do a 'perl -V' I get the new paths.

        heres where I'm going crazy:

        I now go to startup my apache with '/etc/init.d/httpd start' and it gives me the same error message as I was getting in my original post. Even though /usr/bin/perl is a link to /usr/local/bin/perl, Apache is looking for the 5.6.0 perl paths. Does apache get its path information from a different place? please help.

        (BTW thank you so much for your help so far)
        Brian