[Tutor] python cgi debugging 101
Sean 'Shaleh' Perry
shalehperry@attbi.com
Sun May 25 19:39:02 2003
On Sunday 25 May 2003 19:11, Pijus Virketis wrote:
> Dear all,
>
> I am trying to install pyblosxom
> (roughingit.subtlehints.net/pyblosxom), an all-Python blogging engine.
> So far, I am not having much luck. ;) But fear not, I am not asking for
> any program-specific advice. Rather, I would appreciate a few basic
> Python cgi debugging tips and tricks (or a link to a tutorial on the
> subject). Basically, my Apache error log only has this (to me cryptic)
> line:
>
How about some generic CGI wisdom?
A CGI is simply a script which reads from standard input and writes to
standard output. It may also get some variables from the environment. So a
simple way to start debugging is to simply run the CGI by hand from the
command line. A lot of time you end up with things like:
* wrong location for the interpreter. it uses /usr/local and yours is in /usr
for instance
* missing file or directory. Maybe it wants logs in /var/log/myscript or a
helper program in /usr/share/myscript/helper.
* permissions. Maybe it needs something from the last item and even though it
exists this CGI does not have the rights to look/use/edit it.
* an actual code bug
This applies to any CGI in any language.