kcott has asked for the wisdom of the Perl Monks concerning the following question:

Compiling and Installing - Apache HTTP Server Version 2.4 has:

"If you have multiple Perl interpreters ..., you are advised to use the --with-perl option (see below) to make sure the correct one is used by configure."

I've been wondering if it was possible to change the Perl version via configuration (e.g. httpd.conf) instead of via ./configure.

Versions I'll be working with:

Any information on this would be appreciated. Thanks.

Update (Additional Information): There were a couple of replies asking "Why?". The main reason is to be able to change Perl versions quickly: change httpd.conf, bounce Apache and test new version vs. run ./configure & Co.

An example scenario might be to test v5.18.2: change config, bounce, test - if test fails, change config back to v5.16.3, bounce again and we're back to the previously working version.

-- Ken

Replies are listed 'Best First'.
Re: Specifying Perl version to Apache via httpd.conf
by taint (Chaplain) on Jun 05, 2014 at 05:09 UTC
    Hello, kcott!

    Sure it is. But I have to say, A M had a point. Why?

    Only one -- well possibly more. But one, for sure. That being; if you happen to have mod_perl, it's not likely going to work. Another thing I guess needs to be asked. How do you use Perl on the Apache? Scripts could give a care. The shebang says it all. Really, the more I think about it, I've seen many pointers regarding the use of specific versions of Perl utilized, by simple stanzas within the httpd.conf file.

    But, like A M asked; why? Imparting any specific details related to the task, will largely depend upon that.

    Anyway. The short, and simple answer to your question, is, Yes. :)

    --Chris

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

      "But, like A M asked; why? Imparting any specific details related to the task, will largely depend upon that."

      I've added an update to the OP with that information.

      -- Ken

Re: Specifying Perl version to Apache via httpd.conf
by Anonymous Monk on Jun 05, 2014 at 03:36 UTC
    For what purpose?

      I've added an update to the OP explaining this.

      -- Ken

Re: Specifying Perl version to Apache via httpd.conf
by Anonymous Monk on Jun 05, 2014 at 19:23 UTC

    I think --with-perl is largely historical cruft, at least for Linux/Unix type systems. I suspect that .configure will just "do the right thing" and find the perl installed by your distro. It seems like all that option probably does is rewrite the shebang lines in the helper scripts.

    In the old days, this mattered because there were lots of systems where /usr/bin/perl was version 4. On a lot of our systems, we had /usr/bin/perl5 for a long time. Anyhow, the scripts need Perl 5 so we get that option.

    To be fair, that option may still matter a lot on other platforms that don't really have a canonical location for Perl.

      "I think --with-perl is largely historical cruft, at least for Linux/Unix type systems. I suspect that .configure will just "do the right thing" and find the perl installed by your distro."

      I'm looking at options for using a Perl that is not the one "installed by your distro". See the update to the OP for more information on that.

      -- Ken

        Hello again, kcott, and thanks for the update.

        For the record; I wans't trying to be "nozey", or anything. But I found it hard to speak specifically to solution(s) w/o a bit more info. :)

        As I mentioned in my original response to your question; isn't it enough to simply tell your Perl applications which Perl to use? I'm thinking "shebang" here, but I know many of the other stuff allows you to setup any desired ENV you might/may require.

        As I await your response, I'll go dig up all the old links I have for httpd.conf related stanza's I recall having seen, a couple, or so years ago, and update this post, or reply as appropriate.

        --Chris

        UPDATE:
        I think the following covers what I had recalled, pretty well:
        perl-apache-httpd-conf
        P.S. Just for the record; you can do all of this on VirtualHost basis, meaning; a different host can run a different Perl -- my own recollection.

        ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

Re: Specifying Perl version to Apache via httpd.conf
by taint (Chaplain) on Jun 06, 2014 at 03:27 UTC
    Two last items of possible interest, before I call it a night.

    You can set related values with the AddHandler directive. There are also some very powerful ENV options available with the Apache -- I'll defer to their docs, as it would be quite lengthy here. :).

    In closing, I can tell you, having hacked on the actual C code for the HTTPd, that the Apache is very Perl-centric. In fact, if you're even a fair C hacker, you can pretty easily hack up a "custom" HTTPd that easily caters to your particular needs. :)

    --Chris

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH