Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use a vendor Apache with a self-compiled Perl and mod_perl?

I want to use Apple's or RedHat's built-in Apache but I want to use Perl 5.10 and mod_perl. What's the least intrusive way to accomplish this? I want the advantage of free security patching for the vendor's Apache, dav, php, etc., but I care a lot about which version of Perl I use and what's in my @INC path. I don't mind compiling my own mod_perl.

like image 422
Chris Dolan Avatar asked Sep 17 '08 02:09

Chris Dolan


3 Answers

  1. Build your version of Perl 5.10 following any special instructions from the mod_perl documentation. Tell Perl configurator to install in some non-standard place, like /usr/local/perl/5.10.0

  2. Use the instructions to build a shared library (or dynamic, or .so) mod_perl against your distribution's Apache, but make sure you run the Makefile.PL using your version of perl:

    /usr/local/perl/5.10.0/bin/perl Makefile.PL APXS=/usr/bin/apxs

  3. Install and configure mod_perl like normal.

It may be helpful, after step one, to change your path so you don't accidentially get confused about which version of Perl you're using:

export PATH=/usr/local/perl/5.10.0/bin:$PATH
like image 85
Michael Cramer Avatar answered Oct 20 '22 01:10

Michael Cramer


You'll want to look into mod_so

like image 41
Ian Avatar answered Oct 19 '22 23:10

Ian


I've done this before. It wasn't pretty, but it worked, especially since vendor perl's are usually 2-3 years old.

I started with making my own perl RPM that installed perl into a different location, like /opt/. This was pretty straight forward. I mostly started with this because I didn't want the system utilities that used perl to break when I upgraded/installed new modules. I had to modify all my scripts to specify #!/opt/bin/perl at the top and sometimes I even played with the path to make sure my perl came first.

Next, I grabbed a mod_perl source RPM and modified it to use my /opt/bin/perl instead of /usr/bin/perl. I don't have access to the changes I made, since it was at a different gig. It took me a bit of playing around to get it.

It did work, but I'm not an RPM wizard, so dependency checking didn't work out so well. For example, I could uninstall my custom RPM and break everything. It wasn't a big deal for me, so I moved on.

I was also mixing RPM's with CPAN installs of modules (did I mention we built our own custom CPAN mirror with our own code?). This was a bit fragile too. Again, I didn't have the resources (ie, time) to figure out how to bend cpan2rpm to use my perl and not cause RPM conflicts.

If I had it all to do again, I would make a custom 5.10 perl RPM and just replace the system perl. Then I would use cpan2rpm to create the RPM packages I needed for my software and compile my own mod_perl RPM.

like image 25
Gary Richardson Avatar answered Oct 20 '22 00:10

Gary Richardson