debugging CGI script for apache -- how?

John Chambers jc at
Fri Aug 18 22:43:45 EDT 2006

| I am having problems figuring out how to debug
| a failing script running as under cgi with
| the apache web server.
| The script runs just find by itself.
| However, one of the programs called by the script
| gets the rather frustrating
|   Segmentation fault
| What is different about the apache cgi environment?

The first thing I usually do in testing a CGI script is  to
have it print out its full environment.  And I usually have
it use full paths to any subprocesses, because I've had too
many surprises with subtle differences in the PATH list.

These usually cover most of the differences that cause that
sort of behavior change. The segfault is likely because the
program  is  assuming  that  something  got  set  from  its
environment,  because  it  was  always  there in your shell
environment, but httpd didn't provide it.

   O   John Chambers
 <:#/> <jc at>
   +   <jc1742 at>
  /#\  in Waltham, Massachusetts, USA, Earth
  | |
  ' `

More information about the Discuss mailing list