Electronics Circuits & Tutorials - Electronics Hobby Projects - A Complete Electronic Resource Centre
Electronics Circuits & Tutorials

Home Electronics Tutorials Electronics Gadgets Videos About us Contact us Sitemap
Tutorials
  • Basic/Beginners
  • Intermediate/Advance
  • Microcontrollers
  • Microprocessors
  • Electronics Symbols
  • Electronics Formulas
  • Dictionary of Units

     more....

Dictionaries
  • Electronics Terms
  • Abbreviations
  • Computer Terms
  • Physics Glossary
  • Science Glossary
  • Space & Solar Terms
  • Semiconductor Symbols / Abbreviation
  • Radio Terminology Bibliography

     more....

Projects
  • Engineering Projects
Home > Electronics Tutorials > Online Computer Terms Dictionary > C

Online Computer Terms Dictionary - C

CGI script ==>

Common Gateway Interface

<World-Wide Web> (CGI) A standard for running external programs from a World-Wide Web HTTP server. CGI specifies how to pass arguments to the program as part of the HTTP request. It also defines a set of environment variables that are made available to the program. The program generates output, typically HTML, which the web server processes and passes back to the browser. Alternatively, the program can request URL redirection. CGI allows the returned output to depend in any arbitrary way on the request.

The CGI program can, for example, access information in a database and format the results as HTML. The program can access any data that a normal application program can, however the facilities available to CGI programs are usually limited for security reasons.

Although CGI programs can be compiled programs, they are more often written in a (semi) interpreted language such as Perl, or as Unix shell scripts, hence the common name "CGI script".

Here is a trivial CGI script written in Perl. (It requires the "CGI" module available from CPAN).

 #!/usr/bin/perl
 use CGI qw(:standard);

 print header, start_html,
   h1("CGI Test"),
   "Your IP address is: ", remote_host(),
   end_html;

When run it produces an HTTP header and then a simple HTML page containing the IP address or hostname of the machine that generated the initial request. If run from a command prompt it outputs:

 Content-Type: text/html

 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <HTML><HEAD><TITLE>Untitled Document</TITLE>
 </HEAD><BODY><H1>CGI Test</H1>Your IP address is:
 localhost</BODY></HTML>

The CGI program might be saved as the file "test.pl" in the appropriate directory on a web server, e.g. "/home/httpd/test".

Accessing the appropriate URL, e.g. http://www.acme.com/test/test.cgi, would cause the program to run and a custom page produced to be returned.

Early web servers required all CGI programs to be installed in one directory called cgi-bin but it is much better to keep them with the HTML files to which they relate unless they are truly global to the site. All modern web servers make this easy. Similarly, it is neither necessary nor desirable for all CGI programs to have the extension ".cgi", especially on Microsoft Windows servers.

Each CGI request is handled by a new process. If the process fails to terminate for some reason, or if requests are received faster than the server can respond to them, the server may become swamped with processes. In order to improve performance, Netscape devised NSAPI and Microsoft developed the ISAPI standard which allow CGI-like tasks to run as part of the main server process, thus avoiding the overhead of creating a new process to handle each CGI invocation.

Current version: 1.1.

NCSA.

(2004-12-27)

 


Nearby terms: Common Communication Services « Common Desktop Environment « Common ESP « Common Gateway Interface » Common Hardware Reference Platform » Common Information Model » Common Intermediate Format
 

Circuits
A B C D
E F G H
I J K L
M N O P
Q R S T
U V W X
Y Z    
Discover
  • C/C++ Language Programming Library
  • Electronic Conversions
  • History of Electronics
  • History of Computers
  • Elec. Power Standards
  • Online Calculator and Conversions
  • Electrical Hazards - Health & Safety
  • Datasheets
  • Quick Reference links
  • Electronics Magazines
  • Career in Electronics
  • EMS Post Tracking

     more......

Home Electronic Tutorials Engineering Hobby Projects Resources Links Sitemap Disclaimer/T&C

Copyright © 1999-2020 www.hobbyprojects.com  (All rights reserved)