0

I'm trying to run mod_perl on El capitan.

Process

  1. Following http://blog.n42designs.com/blog/2014/10/23/compiling-mod-perl-for-apache-2-dot-4-on-os-x-10-dot-10-yosemite/ an https://stackoverflow.com/questions/34240610/how-to-install-mod-perl-2-0-10-in-apache-2-4-on-os-x-el-capitan

  2. The correct repository is different for El capitan, so use svn co https://svn.apache.org/repos/asf/perl/modperl/tags/2_0_9/

    2.perl Makefile.PL MP_CCOPTS=-std=gnu89 ; make ; sudo make install I could get /usr/libexec/apache2/mod_perl.so

  3. In /etc/apache2/other directory, I added cgi.conf with the following content.


LoadModule perl_module libexec/apache2/mod_perl.so
#PerlModule ModPerl::Registry

<Location "/Library/WebServer/Documents/cgi/">
    SetHandler perl-script
    PerlResponseHandler ModPerl::Registry
    Options ExecCGI
    PerlSendHeader On
    Order allow,deny
    Allow from all
</Location>

I copied simple perl cgi script in the /Library/WebServer/Documents/cgi/ directory, but instead of execution the perl script, the perl code is shown.

What might be wrong?

ADDED

After adding these lines in the conf file:

<Files ~ "\.(pl|cgi)$">
    SetHandler perl-script
    PerlResponseHandler ModPerl::PerlRun
    Options +ExecCGI
    PerlSendHeader On
</Files>

I have errors instead:

[perl:error] [pid 26307] [client ::1:60248] failed to resolve handler `ModPerl::PerlRun': Can't locate ModPerl/PerlRun.pm in @INC (you may need to install the ModPerl::PerlRun module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 ...
0

For Mac OS X, /Library/WebServer/CGI-Executables has already setup, so there should be no configuration. So, just copying echo.pl in the directory, and use the perl script with localhost/cgi-bin/echo.pl.

To make it work anyway

We need a ModPerl::PerlRun to install the CPAN module before the compilation.

sudo cpan ModPerl::PerlRun

This also creates and installs the perl_mod.so, but this breaks the apache, so we need to rebuild the module. This is the working configuration.

LoadModule perl_module libexec/apache2/mod_perl.so

<Location "/Library/WebServer/Documents/cgi/">
    Options ExecCGI
    Order allow,deny
    Allow from all
</Location>

<Files ~ "\.(pl|cgi)$">
    SetHandler perl-script
    PerlResponseHandler ModPerl::PerlRun
    Options +ExecCGI
    PerlSendHeader On
</Files>

Now localhost/cgi/echo.pl is the address to access.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .