Sunday, October 01, 2006

6 months without perl

My memory is that I reimaged somtime around march, and I haven't installed activeperl until now. Scary thought.

Anyhow, as usual, I'd completely forgotten how to setup perl cgi on Apache (which for whatever reason did not take 6 months to install, so maybe I can still call myself a web developer...), but a quick google diggs up a page on a site called the site wizard that provides much of the information that I need, with apache error logs providing the rest.

Folks who wrote the error handling code for apache deserve major good karma, and probably more credit than they get for the success of this application. Amazing how often you can find the information you need in the error log.

So the steps I took, so I can look here next time I do it:

  1. create super simple CGI.pm script

    use CGI qw/:standard/;

    print header,
    start_html('A Simple Example'),
    h1('A Simple Example');


  2. Add Handler directive so apache knows that .pl means cgi script

    AddHandler cgi-script .pl


  3. set +ExecCGI permission on the relevant directory (I turn off apache when I'm out in the wild).

    <Directory "C:/htdocs">
    Options Indexes FollowSymLinks +ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>


  4. Tell apache where to find perl, so my script now looks like this

    #! /Perl/bin/perl

    use CGI qw/:standard/;

    print header,
    start_html('A Simple Example'),
    h1('A Simple Example');



Voila. apache is up and running. Now to see if I can remember why I installed perl in the first place.

No comments: