1

I'm trying to get perl running under on my Apache 2 macports install. I'm hoping an experienced perl geek can help me out. I've...

  1. Got Apache running just dandy. Macports installed it with perl5 placeholder and perl5.8.9.
  2. Installed mod_perl2.
  3. Run the script to configure httpd.conf.
  4. Restarted apache.
  5. Written the following test script in htdocs

    #!/opt/local/bin/perl
    print "content-type: text/html \n\n";
    print 'Hello world.';  
    

All I get is the script contents printed out to the screen. Am I missing a step? Is there some additional configuration I need to do in the .conf file?

Svante
  • 50,694
  • 11
  • 78
  • 122
Brooks
  • 2,082
  • 2
  • 18
  • 26
  • Is `/opt/local/bin/perl` the location of the perl binary (or a symlink to one)? If not, start by fixing that. – Matt Ball Mar 10 '10 at 20:22
  • correct. /opt/local/bin/perl is where macports installs the perl binary (i confirmed that it's there). I tried /usr/local/bin/perl just for fun and, as expected, it didn't work either. – Brooks Mar 10 '10 at 20:28
  • Now I assume the path specified on the first line is absolute and not relative to htdocs or anything like that – Brooks Mar 10 '10 at 20:30

1 Answers1

2

Apache hasn't been configured to recognize certain file types as cgi executables. Adding this line to your httpd.conf will do the trick, although there are many other ways of configuring this to achieve the same effect:

AddHandler cgi-script .cgi .pl

You may also have to add ExecCGI to an options list for your domain. See Apache Tutorial: Dynamic Content with CGI for more information.

Ether
  • 53,118
  • 13
  • 86
  • 159