[GRASSLIST:161] RE: running grass commands from CGI script
Glynn Clements
glynn.clements at virgin.net
Fri May 23 18:56:43 EDT 2003
Matt Doggett wrote:
> Upon further investigation, I discovered that if I redirect STDERR and
> STDOUT when I call r.mapcalc, this problem goes away (e.g. `r.mapcalc
> newgrid=A*B*C >somefile 2>&1`).
>
> Maybe someone can shed some light as to what r.mapcalc is doing to
> STDOUT and/or STDERR that might be causing problems with apache?
[What follows assumes that you're using GRASS 5.0.0 or later, which
has a completely re-written r.mapcalc; the r.mapcalc in 4.3 and early
5.0 betas is substantially different.]
r.mapcalc writes error messages to stderr, but this shouldn't
interfere with Apache; it's not uncommon for CGI scripts (or the
programs they call) to write to stderr; any such output should end up
in Apache's error log.
AFAICT, r.mapcalc itself shouldn't write anything to stdout; however,
I can't entirely rule out the possibility that some lower-level
function might write to stdout.
In the CGI script, are you generating the CGI header (Content-Type
etc) early on, or are you leaving it until after r.mapcalc has been
run? If a program writes to stdout before you've written the header,
Apache will try to parse it as a CGI header, with unpredictable
results.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list