What Is the Common Gateway Interface?

The common gateway interface is used to initialize the server-side interface of the software service. This interface describes how the web server communicates with software on the same computer.

Common gateway interface, it is a section
Originally, CGI was established in 1993 by the National Center for Supercomputer Applications (
The common gateway interface is a standard method for a web server to submit user requests to applications and receive and return data from users. When a user requests a web page (for example, clicking on a highlighted word or entering the address of a website), the server returns the requested page. However, when a user fills out a form on a web page and sends it out, it usually needs to be processed by the application. The web server often forwards the information in the form to a small application, which processes the data and returns a confirmation message. This interface for exchanging information between the server and the application is called the universal gateway interface. It is part of the Hypertext Transfer Protocol (HTTP) on the Internet. [2]
Most CGI
CGI
Send user requests through the Internet
CGI
CGI can be written in any language as long as the language has standard input, output, and environment variables. For beginners, it is best to choose easy to archive and can effectively express a large number
SERVER-NAME: Run the CGI sequence as the machine name or IP address. SERVER-INTERFACE: WWW
CGI can provide us with many features that HTML cannot do. Such as a. A counter b. Submission of customer information forms and statistics c. Search

How the Universal Gateway Interface Works

1. The browser requests the URL of a CGI application on the server through an HTML form or hyperlink. 2. The server receives the request. 3. The server executes the specified CGI application. 4. CGI applications perform the required operations, usually based on what the viewer enters. 5. The CGI application formats the results into a document (usually an HTML web page) that the web server and browser can understand. 6. The web server returns the results to the browser.

General gateway interface considerations

The CGI application runs on a server system that can be requested by the browser, and requires execution using server CPU time and memory. If there are thousands of such programs running at the same time, it will place extremely high demands on the server system. You should consider this carefully to prevent the server system from crashing. An imperfect CGI application may become a channel for others to enter the server system illegally, and may cause important data to be deleted or leaked. The main uses of CGI applications are as follows: sending customized responses based on HTML forms filled out by viewers; creating clickable thumbnail images; creating a database where viewers can search for content; providing an interface between the server and the database, and Turn the results into HTML documents; Make dynamic HTML documents. If a CGI script could do the same thing on every computer; writing a script would be easy. Unfortunately, CGI scripts depend on the server's operating system, so for non-UNIX servers, Prl (a common tool for scripting under UNIX) scripts are useless. So, you must customize your CGI script installation. Most servers provide a CGI-BIN directory, but this is not enough. Because you should have your own CGI-BIN. This way, you can run your own scripts (instead of adapting your system to scripts that already exist on the system). Therefore, your provider should install CGI-BIN and be able to help you write scripts

ASP Common Gateway Interface ASP

ASP, Active Server Page, is a programming environment in which you can mix HTML, scripting languages, and components to create server-side powerful Internet applications. If you have previously created a site that mixes HTML, scripting languages, and components, you can add ASP code to it. By adding script commands to your HTML pages, you can create an HTML user interface, and you can also include some business logic rules by using components. Components can be called by script programs or by other components. The working principle of ASP: When ASP functions are integrated into a Web site, the following things will happen: 1. The user calls up the site content. The extension of the default page is .asp. 2. The browser requests the ASP file from the server. 3. The server-side script starts to run ASP. 4. The ASP file starts processing in the order from top to bottom, executes script commands, and executes HTML page content. 5. The page information is sent to the browser. Because the script runs on the server side, the web server sends all standard HTML pages to the browser after all processing is complete. This means that ASP can only run on supported servers. Another benefit of having the script reside on the server side is that the user cannot see the code of the original script program. The user only sees the final HTML content.

PHP Common Gateway Interface PHP

PHP is a server-side scripting language embedded in HTML. What distinguishes PHP from other client-side JavaScript is that its code is executed on the server. What can PHP do? At the lowest level, PHP can do anything other CGI programs can do, such as collecting form data, generating dynamic page content, or Send and receive cookies. Probably the most powerful and meaningful feature is that PHP supports a wide range of databases. Writing a Web page that supports databases is incredibly simple. Here are the currently supported databases: Adabas D InterBase Solid dBase mSQL Sybase Empress MySQL Velocis FilePro Oracle Unix dbm Informix PostgreSQL PHP also supports "talking" with other services through protocols such as IMAP, SNMP, NNTP, POP3, and even HTTP. You can also open obscure network interfaces to interact with other protocols. A brief history of PHP In the fall of 1994, Rasmus Lerdorf began to conceive PHP. An early non-release version was used on his homepage to track who was looking at his online resume. The first version was released in early 1995, when PHP was only considered as a homepage development Tool. It consists of a very simple analysis engine that understands only a few special macros and some applications. Common tools on the back end of the homepage. Like guestbooks, counters and other things. This analyzer was rewritten in mid-1995 and named PHP / FI Second Edition. FI comes from another package written by Rasmus, Used to interpret data in html form. He combined personal homepage tool script and form parser, and added mSQL support. This generated PHP / FI. PHP / FI grew at an amazing pace, and people started putting their own The code contributes to it. It is difficult to give it a hard statistical table, but it can be estimated that at the end of 1996, at least 15,000 websites in the world were using PHP / FI. By mid-1997, this number had exceeded 50,000. And in The development of PHP also changed at this time. The project developed by Rasmus himself and several people turned into a more organized group achievement. Zeev Suraski and Andi Gutmans rewritten the parser. This new parser became the PHP version 3 basis. Many useful codes are inherited from PHP / FI to PHP3, and many are completely rewritten. Today (mid 1999) whether PHP / FI or PHP3 is bundled with many commercial products, such as C2 level strength Web Services Server and Red Hat Linux. Based on the data provided by NetCraft, it is inferred that there are conservatively estimated that there are more than 150,000 websites using PHP worldwide. From this, it appears that there are more sites than Netscape's flagship enterprise server running on the Internet.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?