Installing Mod Perl on the macOS Sierra Homebrew Version of Apache 2.4.xx

Written by James McDonald

April 16, 2017

Do this

svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ mod_perl-2.0

cd mod_perl-2.0

perl Makefile.PL MP_APXS=/usr/local/Cellar/httpd24/2.4.25/bin/apxs

# this doesn't do anything but it tells you where 
# apxs will put mod_perl.so
/usr/local/Cellar/httpd24/2.4.25/bin/apxs -q LIBEXECDIR

make

# this will fail when trying to start httpd
# but mod_perl still seems to work
make test 

make install

brew services restart httpd24

To Test
Create a file with perl in it and copy to a cgi-bin directory in your website…

#!/usr/bin/env perl
#

print "\n\n";

print "Hello world\n";

You may have to run cpan and install missing modules when you start using mod_perl check your Apache access.log or error.log

2 Comments

  1. GiDi

    I hope, you can help me:

    perl Makefile.PL MP_APXS=/usr/local/Cellar/httpd24/2.4.25/bin/apxs

    Here I get a error:

    [ error] Unable to determine server version, aborting.
    [ error] Invalid MP_APXS specified?

    I have yesterday installed with HOMEBREW httpd24/2.4.33
    Too other Version 2.4.33 gives error!

    Reply
    • James

      What does httpd -v say and what does which httpd

      Reply

Submit a Comment

Your email address will not be published.

You May Also Like…

ZPL SBPL

Zebra Printer Language http://labelary.com/viewer.html The above website has a page where you can enter ZPL and it...

PHP Iterators

Just came across a Youtube talk "Iterators in PHP" by Jake Smith published in 2014 that steps through the many...

PHP array_map Multiple Arrays

array_map can take multiple arrays. I like how it starts mapping through them starting at the first element of each...