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. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…