Using and Running CGI Programs
What are CGI Programs ?
CGI programs or scripts are programs that do some processing and then return some
type of page or graphical image to your web browser. They are commonly used to
handle the submission of forms or to display dynamic or changing data. They can
also used to handle searching and the display of search results. CGI programs
can do anything malicious they want to your computer like deleting all of your
files etc so be careful not to install any CGI scripts or programs on your
computer that you don’t completely trust.
Where Can You Find CGI Programs ?
There are thousands of free CGI programs and scripts available on the internet. A
number of web sites are listed on this websites Tools Page that offer free CGI
programs that perform various useful tasks. Many CGI programs come with Web
Forms and other .html pages.
Running and Executing CGI Programs
CGI programs should be placed in MyWebServer's cgi-bin directory. Normally
MyWebServer will try to download any file in any directory below the web
server's root directory when it is requested. The cgi-bin directory is a little
different. MyWebServer will attempt to run files in the cgi-bin directory if
"Use Enable /cgi-bin directory" is enabled on MyWebServer's Server Properties Page.
If the file has an .exe, .com or
.bat file name extension MyWebServer will just execute it. Files with any other
file name extension need to be mapped to some program that will execute them
like a script interpreter. You can add or change Script Mappings by clicking on
the Script Button on the Server Properties Page. Some examples of script
interpreters that are commonly used with web servers are perl, php, and WSH
(Windows Scripting Host).
Running A Sample CGI Program
If you want to try running a pre-made CGI Program:
- Download the HelloWorld.exe sample CGI.
- Place it in your cgi-bin directory which can be found in your server root directory.
- Make sure "Use Enable /cgi-bin directory" is enabled on the Server Properties Page.
- You should be able to run the CGI with the following URL:
http://localhost/cgi-bin/HelloWorld.exe
- You should see "Hello World" displayed on a web page if it is working.
Running A Sample CGI PERL Script
If you want to try running a pre-made CGI Script:
- Make
sure perl is installed on your computer you can get a windows build from Active State.
- Download the HelloWorld.pl sample CGI.PERL script.
- Place it in your cgi-bin directory which can be found in your server root directory.
- Make sure "Use Enable /cgi-bin directory" is enabled on the Server Properties Page.
- Click Script on the Server Properties Page and make sure there is a mapping for
cgi to the perl interpreter perl.exe. You should enter the complete path to
perl.exe unless you have perl's location in your computers path statement.
- You should be able to run the CGI from your computer with the following URL:
http://localhost/cgi-bin/HelloWorld.pl
- You should see "Hello World" displayed on a web page if it is working.
Where Do You get Free Scripting Engines ?
You can download and install several free scripting engines (interpreters) here
are just a few.
How Do you Create Your Own CGI Programs And Scripts ?
Click
Here For An Article On Writing Your Own CGI Programs And Scripts.
|