August 22, 2007

Apache Win32 development and linux deploy with perl and no hassles

Just a quick little problemsolving exercise I did this afternoon, revolving around the discovery of the ScriptInterpreterSource apache directive.
The setup: I develop on a Windows laptop and deploy my stuff to shared hosting on Linux (specifically Site5, which has good perl support and are happy to install modules). I'm just running small scale stuff, so I just roll out plain CGI. Simpler and faster and works for small values of n. I have shell access and subversion running and that combo Just Works. What was before right now a little annoying was local Win32 test of the scripts without modification, because apache cgi uses the hashbang line to determine the cgi executable - which I also need on the host with a different setting. Thankfully, adding

ScriptInterpreterSource Registry
to the CGI config deals with that. Now Win32 apache looks for the string value
HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command
in the registry instead of the hashbang and Bob's your uncle.
Btw, rolling 10 different mini apps out of subversion I found the
<DirectoryMatch cgi-bin>
directive helpful, regex matching against 10 parallel cgi subdirectories, so I don't have to set each one up separately. And a little gotcha I encountered:
        SetHandler cgi-script
Options ExecCGI FollowSymLinks -Indexes
- remember the FollowSymlinks or the ExecCGI is disabled (? or so it seems from error messages)
In view of this remember to only serve stuff up locally from a proper vhost, so getting just http://localhost does nothing (harmful).

Posted by Claus at August 22, 2007 5:21 PM
Comments
Post a comment