Skip navigation

Apache Perl config

3401 Views 4 Replies Latest reply: Dec 27, 2012 4:24 PM by etresoft RSS
greenyouse Calculating status...
Currently Being Moderated
Dec 27, 2012 10:05 AM

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

    </IfModule>

</IfModule>

 

$ 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

</Location>

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 Level 7 (23,905 points)
    Currently Being Moderated
    Dec 27, 2012 11:22 AM (in response to greenyouse)

    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...

     

    this...

     

    #!/usr/bin/perl

     

    use strict;

     

    use CGI;

     

    my $out = CGI->new();

     

    print $out->header();

     

    print << "EOS";

    <html>

      <body>

        <h1>Hello World</h1>

        <body>$ENV{"MOD_PERL"}</body>

      </body>

    </html>

    EOS

     

    output this...

     

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

    <html>

      <body>

        <h1>Hello World</h1>

        <body>mod_perl/2.0.5</body>

      </body>

    </html>

     

    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...

  • etresoft Level 7 Level 7 (23,905 points)
    Currently Being Moderated
    Dec 27, 2012 2:12 PM (in response to greenyouse)

    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 Level 7 (23,905 points)
    Currently Being Moderated
    Dec 27, 2012 4:24 PM (in response to greenyouse)

    That first line of the user config file should be:

    AddHandler perl-script .pl

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.