Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Overriding the registry's PERL5LIB in mod_perl on Win32

by perrin (Chancellor)
on May 21, 2009 at 15:28 UTC ( #765476=note: print w/replies, xml ) Need Help??

in reply to Overriding the registry's PERL5LIB in mod_perl on Win32

Uh, you're asking how to protect against sabotage? I suppose you could write a wrapper script in another language that checks the registry before starting apache.
  • Comment on Re: Overriding the registry's PERL5LIB in mod_perl on Win32

Replies are listed 'Best First'.
Re^2: Overriding the registry's PERL5LIB in mod_perl on Win32
by shay (Beadle) on May 21, 2009 at 17:08 UTC
    Yes, I was coming round to that sort of idea myself.

    What it needs is something to set PERL5LIB in the environment (thus cloaking any nasty registry setting) before the LoadFile directive that loads perl510.dll, but there are no Apache or mod_perl directives to do that.

    The nearest that we have is SetEnv and PerlSetEnv, but they just set the environment seen by CGI scripts and mod_perl handlers much later on.

    The other idea is simply to rebuild my perl without that horrible registry lookup misfeature in it. It only requires a couple of lines to be deleted from win32/win32.c's win32_getenv(). In fact, in the email thread cited in my original post, Jan Dubois has already suggested actually removing it from perl altogether, so I might just take him up on pursuing that on p5p. (I'll still need to patch my own perl in the meantime, however: I can't wait until 5.12 for a fix.)

      I have no idea how it works on Windows, but on Linux all you need to do to set PERL5LIB is put it on the command-line when you start apache: PERL5LIB=/my/path apachectl start
        On Win32 Apache is run as a service. The command-line to run is specified in the registry under


        In my case this is:

        "C:\apache2.2\bin\httpd.exe" -k runservice

        It isn't as simple as just changing that to something like:

        set PERL5LIB=C:\perl\lib;C:\perl\site\lib && "C:\apache2.2\bin\httpd.exe" -k runservice

        but possibly some kind of wrapper program could be worked in there which sets PERL5LIB and then runs the service.

        I think I'm going to settle for just removing the registry lookup from my perl build, though.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://765476]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2019-12-07 20:36 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (162 votes). Check out past polls.