4 Replies Latest reply: Dec 27, 2012 4:24 PM by etresoft
greenyouse Level 1 (30 points)

Hi, I'm trying to get Apache to support perl using 10.6.8 but I'm having some trouble.  I saw that there was "mod_perl.so" in /usr/libexec/apache2 so I tried to activate it and point perl to my local Sites folder.  Here are the commands that I used:

$ sudo apxs -a -e -n "perl" mod_perl.so     #activate perl module

$ sudo vim /etc/apache2/extra/perl_module.conf

(added this to file)


# Required modules: dir_module, perl_module

<IfModule dir_module>

    <IfModule perl_module>

        DirectoryIndex index.pl index.html




$ sudo vim /etc/apache2/httpd.conf

(added this to file)


# Perl support


Alias /Sites/ /Users/USERNAME/Sites/

<Location /Sites/>

    AddHandler perl-script .pl, .chi

    Options +ExecCGI

    Order allow,deny

    Allow from all


Include /etc/apache2/extra/perl_module.conf


$ sudo apachectl -t -D DUMP_MODULES     #debug to make sure httpd.conf doesn't have errors

This setup still refuses to load my "index.pl" script.  Does anyone with perl knoweldge know how to get this set up correctly?

MacBook, Mac OS X (10.6.8)
  • etresoft Level 7 (27,445 points)

    I can't help much with 10.6.8. On Mountain Lion, all I had to do was:

    1) Enable mod_perl in httpd.conf

    2) Add the following to my user config file:

        SetHandler perl-script

        PerlHandler ModPerl::Registry

        Options (previous stuff) ExecCGI

    3) Restart Apache and...






    use strict;


    use CGI;


    my $out = CGI->new();


    print $out->header();


    print << "EOS";



        <h1>Hello World</h1>






    output this...


    /Users/jdaniel/Sites $ curl http://localhost/~jdaniel/hello.pl



        <h1>Hello World</h1>





    PS: I getting back into Perl CGI now that I just resized my Linux PHP servers flat out can't emit a content-length greater than 2GB. My Mac, of course, has no problem with it. IT, of course, would never run a Mac. On an entirely unrelated note, said anti-Mac IT broke 4 out of my 6 Linux servers taking about 90% of my processing power. Sorry, I digress...

  • greenyouse Level 1 (30 points)

    Huzzah! It worked right away.  I had totally forgotten about the user config file.  Thanks for the help!


    PS: That's weird that the Linux php stops working like that.  I don't really know but maybe switching to the newest version of php and running 64bit would change something? (other people have had this problem too)  Too bad about the IT staff though.

  • etresoft Level 7 (27,445 points)

    I'm just ranting. I thought it was funny that you posted a question like this just one the day that I was writing my first Perl CGI in 15 years or so - just to get around this PHP bug. It shouldn't even be a 64-bit issue. It is just an HTTP header. Why can't I put what I want in them?


    It's all an IT issue. Linux is only as good as your IT support. If you are maintaining one machine and doing it yourself, Linux is no big deal. When you have 8 then upgrading things at the drop of a hat only causes problems. Running OS X is like having Linux with a really funky distro but a really good sysadmin.


    I'm glad you got it working. I'm always glad to see people using Perl.

  • etresoft Level 7 (27,445 points)

    That first line of the user config file should be:

    AddHandler perl-script .pl