From: Rich Bowen
In order to get your CGI programs to work properly, you'll - need to have Apache configured to permit CGI execution. There + need to have httpd configured to permit CGI execution. There are several ways to do this.
-httpd.conf you need to make sure the
The
The example shown is from your default httpd.conf
- configuration file, if you installed Apache in the default
+ configuration file, if you installed httpd in the default
location. The /cgi-bin/ should be served from
the directory /usr/local/apache2/cgi-bin/, and should be
treated as a CGI program.
For example, if the URL
http://www.example.com/cgi-bin/test.pl
- is requested, Apache will attempt to execute the file
+ is requested, httpd will attempt to execute the file
/usr/local/apache2/cgi-bin/test.pl
and return the output. Of course, the file will have to
exist, and be executable, and return output in a particular
- way, or Apache will return an error message.
The above directive tells Apache to permit the execution +
The above directive tells httpd to permit the execution
of CGI files. You will also need to tell the server what
files are CGI files. The following
Even if you are not familiar with Perl, you should be able
- to see what is happening here. The first line tells Apache
+ to see what is happening here. The first line tells httpd
(or whatever shell you happen to be running under) that this
program can be executed by feeding the file to the
interpreter found at the location /usr/bin/perl.
@@ -289,19 +289,19 @@ print "Hello, World.";
If your CGI program depends on non-standard environment variables, you will need to - assure that those variables are passed by Apache.
+ assure that those variables are passed by httpd.When you miss HTTP headers from the environment, make sure they are formatted according to @@ -399,13 +399,13 @@ print "Hello, World.";
(Do not call the perl interpreter. The shell
- and Apache should find the interpreter using the path information on the first line of
the script.)
The first thing you see written by your program should be
a set of HTTP headers, including the Content-Type,
- followed by a blank line. If you see anything else, Apache will
+ followed by a blank line. If you see anything else, httpd will
return the Premature end of script headers error if
you try to run it through the server. See Writing a CGI program above for more
@@ -436,7 +436,7 @@ print "Hello, World.";
To check if you are using suexec, run apachectl
-V and check for the location of SUEXEC_BIN.
- If Apache finds an
Unless you fully understand suexec, you should not be using it. @@ -473,7 +473,7 @@ print "Hello, World.";
During the CGI transaction, the server and the browser also set environment variables, so that they can communicate with one another. These are things like the browser type - (Netscape, IE, Lynx), the server type (Apache, IIS, WebSite), + (Chrome, Firefox, Lynx), the server type (Apache httpd, Nginx, IIS), the name of the CGI program that is being run, and so on.
These variables are available to the CGI programmer, and
@@ -487,10 +487,10 @@ print "Hello, World.";
similar programs are included in the
cgi-bin
- directory of the Apache distribution. Note that some
+ directory of the httpd distribution. Note that some
variables are required, while others are optional, so you may
see some variables listed that were not in the official list.
- In addition, Apache provides many different ways for you to
+ In addition, httpd provides many different ways for you to
add your own environment variables
to the basic ones provided by default.
Note that questions about CGI problems should never - be posted to the Apache bug database unless you are sure you - have found a problem in the Apache source code.
+ be posted to the httpd bug database unless you are sure you + have found a problem in the httpd source code.