CGI

What is CGI (Common Gateway Interface)?

CGI (pronounced “see-jee-eye”) is a mechanism for running programs on a web server.

Simple Explanation

  • CGI is a method that allows a web server to execute programs in response to client requests and generate web pages on-the-fly.
  • In other words, it’s a system for running programs on a web server to create web pages dynamically.

Detailed Explanation

  1. How Web Pages Are Usually Displayed:
    • When you want to view a web page, your browser sends a request to a web server.
    • The web server responds with a pre-made page.
    • This is the typical process for displaying web pages.
  2. How CGI Works:
    • CGI allows the web server to run a program in response to a request and generate a web page in real time.
    • This means the content of the page can be created on-the-fly based on the request.
  3. Examples of CGI:
    • CGI can be used to create web pages that respond to user inputs or requests, such as displaying personalized messages or retrieving data from a database.
    • For example, if “Piyo-tai” accesses the page, it might show “Welcome, Piyo-tai!” while for “Piyo-ko,” it could show “Welcome, Piyo-ko!”
  4. Common Uses of CGI Programs:
    • Contact Forms: A CGI program can process user input from a contact form and send an email.
    • Dynamic Content: Display real-time information, such as weather updates or latest news, by generating pages dynamically.
  5. Note:
    • The term CGI sometimes refers to the actual programs running on the web server, but it primarily denotes the mechanism for executing these programs.

Summary

In short, when you hear “CGI,” think of it as a system for running programs on a web server to dynamically generate web pages.