Mod Perl on OSX
Building your own perl is very easy (though time consuming for the computer) and then you can compile your own mod_perl which will tie into the new perl nicely. I don't recommend doing this in a production env (simply because I'm still learning all of this so may be giving incomplete advice here) but it's working nicely at home now. Do feel free to copy and paste the code.
Please note that I did all of this under root, rather than using sudo. I'm sure this isn't the perfect way to do it, but it's a home machine that I use this on and I didn't want any permissions problems with my laptop which has become rather confused about things (that'll be after all the evil things I've done to it while learning ;)
Here's a full list of comands to do it:
First build perl by following these instructions:
make the following directory: /usr/local/src
then change into it:
cd /usr/local/src
Go to this url to download perl in your browser.... you'll get redirected to a mirror
http://search.cpan.org/CPAN/authors/id/N/NW/NWCLARK/perl-5.8.7.tar.gz
Move it into /usr/local/src and untar it.
tar xzf perl-5.8.7.tar.gz
follow the install instructions at:
http://search.cpan.org/~nwclark/perl-5.8.7/INSTALL
notes on OSX builds at:
http://search.cpan.org/~nwclark/perl-5.8.7/README.macosx
in summary these are:
cd perl-5.8.7
rm -f config.sh Policy.sh
sh Configure -de
make
make test
make install
you should now have a second perl installed at: /usr/local/bin/perl test its version like so: /usr/local/bin/perl -v
next you need to install apache with mod_perl:
now copy and paster the following into your terminal to compile mod_perl and then apache:
`cd /usr/local/src
curl -O http://www.apache.org/dist/httpd/apache_1.3.33.tar.gz
tar zxvf apache_1.3.33.tar.gz
curl -O http://perl.apache.org/dist/mod_perl-1.0-current.tar.gz
tar zxvf mod_perl-1.0-current.tar.gz
cd ../mod_perl-1.29
/usr/local/bin/perl Makefile.PL \
APACHE_SRC=../apache_1.3.33/src \
NO_HTTPD=1 \
USE_APACI=1 \
PREP_HTTPD=1 \
EVERYTHING=1 make make install`
cd ../apache_1.3.33
./configure \
--with-layout=Apache \
--enable-module=so \
--activate-module=src/modules/perl/libperl.a \
--disable-shared=perl \
--without-execstrip make make install
next edit the second install of apache's httpd.conf to check it's working: pico /usr/local/apache/conf/httpd.conf
add the following at the bottom;
PerlModule Apache::Status
<Location /perl-status>
SetHandler perl-script
PerlHandler Apache::Status
</Location>
then configtest and start: /usr/local/apache/bin/apachectl configtest
/usr/local/apache/bin/apachectl start
load the following in your browser.
http://localhost/perl-status/
and you should see a mod perl server with the latest apache installed.
then install MySQL 4.1.7 and fire up CPAN to get your preferred modules.
If you're reading this and have spotted something wrong/could be done better, please do drop us a line and tell me.... please, for the sake of the newbies.