When a program runs through the web server as a CGI program, it does not have that
path. Any programs that you invoke in your CGI program (like sendmail, for example)
will need to be specified by a full path, so that the shell can find them
when it attempts to execute your CGI program.
Most of the time when a CGI program fails, it’s because of a problem with the
program itself. This is particularly true once you get the hang of this CGI stuff,
and no longer make the above two mistakes. Always attempt to run your program
from the command line before you test if via a browser. This will elimate most
of your problems, and will prevent having to look through cryptic error logs.
For More Information
There are a large number of CGI resources on the Web. You can discuss CGI
problems with other users on the Usenet group
comp.infosystems.www.authoring.cgi. And the -servers mailing list from the
HTML Writers Guild is a great source of answers to your questions. You can
find out more at http://www.hwg.org/lists/hwg-servers/.
When you post a question about a CGI problem that you’re having, whether
to a mailing list, or to a newsgroup, make sure you provide enough information
about what happened, what you expected to happen, and how what actually happened
was different, what server you’re running, what language your CGI program
was in, and, if possible, the offending code. This will make finding your
problem much simpler.
Rich Bowen is the Director of Web Application Development at The Creative Group and the author of Apache Server Unleashed.