cgiwrap - wrapper for CGI scripts which sets environment and captures and reports errors to the browser
mv cgi-script cgi-script-ext; ln -s /opt/css/bin/cgiwrap-stub cgi-script
cgiwrap and its partner script cgiwrap-stub comprise a wrapper for CGI scripts for systems where the web server error_log file is unavailable or simply inconvenient to the CGI author.
Normal behaviour for a failing CGI script is to log error messages to the web server error_log file and for the web server to return an unhelpful 500 series error code to the web browser. While this avoids leaking security sensitive error messages and prevents the semblance of a functioning script which would be bad for a production system), it is very unhelpful to the script developer.
A script wrapped with cgiwrap behaves normally when the script itself works correctly. If an error message escapes the wrapper presents it on the web page with some accompanying environment dump for rapid debugging.
For an arbitrary CGI script cgi-script go:
mv cgi-script cgi-script-ext
ln -s /opt/css/bin/cgiwrap-stub cgi-script
where ext is sh for a script written in shell, pl for Perl, py for Python or ici for ici.
Additionally a Bourne shell file .cgienv.sh may be provided in the directory containing the CGI script. If present, it is sourced to provide environment settings for the script beyond what the web server may provide.
Cameron Simpson <cs@zip.com.au> 30mar1999