Need a way to have apache invoke a new perl

I am building a SLES 11 SP2 server for a developer. He has an application that uses apache to invoke perl scripts via a cgi-script handler. Mmy problem is that he wants to use perl 5.16.2 and has installed it in /opt. The only version available from Novell, via the YaST Sortware Management application, is 5.10.0-

For a SLES 10 server, I installed a more current version of perl than was shipped with SLES and replaced it in the default path. When perl was invoked by any user, the more current version was invoked. This caused virtually all YaST components to fail with various errors. Thus, I couldn’t install any maintenance packages (I was a newbie at the time and didn’t know about zypper). I also didn’t realize that my system was no longer supportable by Novell. I need to retain supportablility for the system, the developer will need to support his own stuff.

How can I set up the system so that the developer’s application can access perl 5.16.2 but all other users will access perl 5.10? I thought of updating the PATH via a .profile but he says that this won’t work. His comments are in the following paragraph.

“Apache doesn’t call perl directly. It uses the cgi-script handler which just runs the .pl file as a shell script. It’s bash/sh that picks up the “#! /usr/bin/perl” line in the .pl file. It won’t accept “#! perl” to use the PATH.”


Hi Harley,

I’m no perl expert, but you might try the following alternative to the invocation line:

“#/usr/bin/env perl”

From the env man page:

env - run a program in a modified environment


Set each NAME to VALUE in the environment and run COMMAND.[/QUOTE]

So if you change the environment (PATH variable) for the Apache httpd, such that your wanted version of “perl” is first in your path, mod_perl then should invoke that perl interpreter. Other programs would still use the default version.

You might be inclined to set the PATH variable within the invocation line - I wouldn’t do that, as you’ll need to change each and every perl script (that’s using this mechanism) whenever you change your perl interpreter location.

Of course, using “#!/usr/bin/perl” would force the use of the default interpreter, so any “typical” perl script will most likely use the system-wide installation, no matter how you set PATH.


What about using the full qualified path then in she bang? i.e.
#! /opt/perl-5.16/perl