Apache is a powerful and flexible HTTP/1.1 compliant
web server. Originally designed as a replacement for the NCSA HTTP
Server, it has grown to be the most popular web server on the
Internet. As a project of the Apache Software Foundation, the
developers aim to collaboratively develop and maintain a robust,
commercial-grade, standards-based server with freely available
source code.
The Apache HTTP Server is distributed at no charge for
commercial or non-commercial use. For more information read the LICENSE.txt file.
Apache can be used with Microsoft Windows. The
Apache HTTP Server Version 2.0 runs under Windows NT, Windows 2000 and
Windows XP. You should download the version of Apache for Windows with
the .msi extension. This is a single Microsoft Installer file containing Apache,
ready to install and run.
The latest Apache HTTP Server version can be downloaded from:
http://httpd.apache.org/
The latest Apache 1.3 documentation can be found at:
http://httpd.apache.org/docs/1.3/
The latest Apache 2.0 documentation can be found at:
http://httpd.apache.org/docs/2.0/
The latest Apache 2.2 documentation can be found at:
http://httpd.apache.org/docs/2.2/
Setup CGI on Unix environment
Information
Most hosting companies offers hosting plans on a Unix environment.
This guide ONLY describes how to setup cgi on such environment.
Operating system used
Unix
Software prerequisites
Apache
Perl
Procedure
- Add the following lines in the .htaccess file located in the docroot:
Options +ExecCGI
AddHandler cgi-script .cgi .pl
- Make sure the <docroot>/cgi-bin directory has the following permissions: 755.
- Create a test script named hello.pl and hello.cgi and enter the following code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";
- FTP both files to the <docroot> and also to <docroot>/cgi-bin
WARNING! When you use the WS_FTP tool to transfer the files, make sure
you select the ASCII transfer mode. Do not select the Binary mode and
do not enable the Auto selection.
- After the files are transferred, make sure the files have the following permissions: 755.
- Execute this script:
https://www.mobilefish.com/hello.pl
https://www.mobilefish.com/hello.cgi
https://www.mobilefish.com/cgi-bin/hello.pl
https://www.mobilefish.com/cgi-bin/hello.cgi
- You should see, "Hello, World."
If not, see your Apache error log file.
If case the following error messages are displayed:
- "Premature end of script headers"
The file transfer went wrong. Manually add an empty line in the .pl and .cgi files
in the Unix environment.
- "Options ExecCGI is off in this directory"
The .htaccess file does not contain the two lines mentioned above.
Also check if the file <docroot>/cgi-bin/.htaccess exist. If so, make this file empty.
|
|