The last two days I've been working off and on to get a new CGI working on the web server here, built using AppleScript. And as with most oddball projects I think up in the middle of the night, it wasn't going as planned.
Turns out the magic key to making it all work is a slick piece of software called acgi Dispatcher, by James Sentman.
What this application does is allow Apache to pass AppleEvents to your CGI, actually an ACGI, which then allows the script to actually do something other than just sitting there.
An AppleScript CGI, like the one described here basically lets you use AppleScript to write some routines that can process information, return a web page, or even interact apps on your web server (potentially dangerous if you don't know what you're doing).
In the case of this sample app, it was returning a web page based on some info passed to it, but though the information on the page indicated that it was 'fully supported' with Apache under OS X Server, that isn't entirely true, and certainly isn't true for standard OS X. Apparently OS X Server 10.3 and up no longer included a necessary component for making these scripts function, but the official Apple workaround (according to their Knowledgebase) for OS X Server 10.3, and apparently for OS X 10.1 and later, is to run the acgi Dispatcher application, which acts as an interface between Apache and AppleScript.
Dispatcher has a 30 day demo, and is $15 for home/educational use, and $35 for commercial use.