With the release of OS X 10.10 Yosemite, Apple upgraded its Apache server to version 2.4.
At release time, mod_perl 2.0.8 was incompatible with Apache 2.4, and mod_perl 2.0.9 had not yet been officially released (more info).
So, Apache was included without mod_perl.
I work locally on a web site using perl and need to install mod_perl.
I'm an experienced programmer, but I have never done anything like this before and have only my main machine to work on. I don't mind spending some time to figure this out, but I can't afford to bork my local server.
How does one install mod_perl on OS X Yosemite?
Sub-questions:
I'm experienced in bash and very comfortable using Terminal.
mod_perl 2.0.8 (latest stable) won't cut it--it's unaware of the deprecation of MPM_NAME in apache 2.4.x Download the latest dev via svn:
svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ mod_perl-2.0
The Changes file lists this version as 2.0.9-dev
Xcode 6.01 won't cut it--it's apache headers will make mod_perl think you're running apache 2.2.26; get Xcode 6.1 (released Oct 20).
Makefile.PL will still have trouble finding ap_release.h (to get your apache version). It's here:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apache2/ap_release.h
Makefile.PL will look by default in /usr/include/apache2
. It will also look for apr headers in /usr/include/apr-1
because the Yosemite-included /usr/bin/apr-1-config
will tell it that's where they are (they're actually in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apr-1
)
/usr/bin/apr-1-config --includedir
/usr/include/apr-1
I tried setting env vars MP_AP_PREFIX
and MP_APR_CONFIG
appropriately, but those values seemed to be ignored. So I made things easier on myself:
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apache2 /usr/include/apache2
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apr-1 /usr/include/apr-1
(thanks to Sean Coyne) Per Jason A. Crome's blog post "llvm/clang on OS X defaults to C99, but mod_perl expects the 89 "standard"
$ perl Makefile.PL MP_CCOPTS=-std=gnu89; make ; sudo make install
The LoadModule
line for mod_perl
has been removed from Yosemite's /etc/apache2/httpd.conf
file.
Add
LoadModule perl_module libexec/apache2/mod_perl.so
to the module section of /etc/apache2/httpd.conf