Domov technika Public gateway interface

Public gateway interface



Interface introduction

It is CommonGatewayInterface, which provides an interface between a computer program and HTTP protocol or WWW service, which is also a human-computer interaction interface; with it, the server can provide an interactive site To replace static text and images in the past. CGI is usually written in PERL, C/C++, DELPHI, etc.

CommonGateInterface is referred to as CGI. Physically, CGI is a program that runs on the Server and provides an interface with the client's Html page. This sentence can be understood as: Most of the personal homepages have a guestbook. The job of the guestbook is like this. The user first enters some information on the client, such as a name. Then the user clicks "Leave a Message" and the browser transmits this information to a specific CGI program in the CGI directory of the server, and the CGI program is processed on the server in a predetermined method. In this case, the information submitted by the user is stored in the specified file. Then the CGI program sends a message to the client, indicating that the requested task has ended. At this time, the user will see the words "message end" in the browser. The whole process is over.

The CGI technology in the movie refers to the screen generated by computergeneratedimage

Function

Most of the CGI programs are used to interpret and process the input information from the form. And generate corresponding processing on the server, or feedback the corresponding information to the browser. CGI programs make web pages have interactive functions.

Running Environment

The CGI program was originally run on a CERN or NCSA format server on the UNIX operating system.

CGI programs are also widely used on servers of other operating systems (such as windowsNT and windows95, etc.), and it is also suitable for various types of machines.

Processing steps

⑴ Send user requests to the server via the Internet.

⑵The server receives the user’s request and hands it to the CGI program for processing.

⑶CGI program transmits the processing result to the server.

⑷The server sends the result back to the user.

Server configuration

Overview

The CGI program can run smoothly without being placed on the server. If you want to make it on the server For smooth operation and accurate processing of user requests, the necessary settings must be made on the server used.

Configuration: According to the type of server used and its settings, put the CGI program in a specific directory or make it have a specific extension.

Configuration of CREN format server

Edit the configuration file of CREN format server (usually /etc/httpd.conf)

Add in the file: Execcgi-bin/*/home/www/cgi-bin/*. The first parameter cgi-bin/* that appears in the exec command indicates the name of the directory that appears in the URL and indicates that it is in the system Appears in the first directory after the host, and another example: the second parameter in the command indicates the real path of the CGI program directory in the system.

The CGI directory can not only place the network files in the same directory, but also in other directories of the system, but you must ensure that you have the same directory in your system. After setting up the server, you must restart the server (unless the HTTP server is started with inetd).

Configuration of NCSA format server

There are two methods for setting on NCSA format server:

①In srm.conf The file (usually in the conf directory) is added: ScriptAlias/cgi-bin/cgi-bin/

The ScriptAlias ​​command indicates that the file in a certain directory is an executable program, and this command is used to execute these Program; the two parameters of this command have the same meaning as the parameters of the Exec command in the CERN format server.

②Add in the srm.conf file: Addtypeapplication/x-httpd-cgi.cgi

This command indicates that a new file type is added to the server, followed by the first One parameter is the MIME type of the CGI program, and the second parameter is the file extension, indicating that the file with this extension is a CGI program.

After setting up the server with one of the above methods, you have to restart the server (unless the HTTP server is started with inetd).

Writing language

CGI can be written in any language, as long as this language has standard input, output and environment variables. For beginners, it is best to choose a language that is easy to archive and can effectively represent a large number of data structures, such as in the linux/unix environment:

·Perl(PracticalExtractionandReportLanguage)

·shell( Bourneshell, etc.) or Tcl(ToolCommandLanguage)

·PHP(HypertextPreprocessor)

In Windows environment:

·C and C++

Because Most servers on the Internet use the linux/unix operating system, and almost any linux/unix operating system has Shell, so it is very convenient to write CGI with Shell.

Finally, Perl has become the mainstream CGI programming language due to its cross-operating system and easy-to-modify features, so that the general "cgi program" is the Perl program.

Environment variable list

SERVER-NAME: Run CGI sequence as machine name or IP address.

SEUVER-INTERFACE: WWW server type, such as: CERN type or NCSA type.

SERVER-PROTOCOL: The communication protocol should be HTTP/1.0.

SERVER-PORT: TCP port, generally the web port is 80.

HTTP-ACCEPT: The type of data that the browser can accept as defined by HTTP.

HTTP-REFERER: The URL of the file sending the form. (Not all browsers transmit this variable)

HTTP-USER-AGENT: Information about the browser that sent the form.

GETWAY-INTERFACE: The version of the CGI program, which is CGI/1.1 under UNⅨ.

PATH-TRANSLATED: The actual path name contained in PATH-INFO.

PATH-INFO: The additional path when the browser sends data in GET mode.

SCRIPT-NAME: The path name of the CGI program.

QUERY-STRING: The data entered in the form, the content after the middle number of the URL.

REMOTE-NOST: The host name of the sending program, the value cannot be determined.

REMOTE-ADDR: The IP address of the machine sending the program.

REMOTE-USBR: The name of the person who sent the program.

CONTENT-TYPE: POST sending, generally applioation/xwww-form-urlencoded.

CONTENT-LENGTH: The number of bytes of data entered by the POST method.

Using CGI

CGI can provide us with many functions that HTML cannot do. For example, a. a counter, b. submission and statistics of customer information forms, c. search process d. WEB database, there is no way to remember any customer information with Html, even if the user is willing to let you know. It is also impossible to record information in a specific file with Html. To record the information of the client segment on the hard disk of the server, CGI is used. This is the most important role of CGI, it supplements the deficiencies of Html. Yes, it is only a supplement, not a substitute.

Supplement

CGI (ComputerGenerationImage) three-dimensional CG

CGI (ComputerGraphicsInterface) computer graphics interface

Engine CGI technology is a Mercedes-Benz In-cylinder direct injection technology developed by the company. The fuel supply action is completely independent of the door and piston system, and the ECU therefore has more dominance. The lean combustion and more diversified mixing ratio beyond the traditional injection theory can be realized. Under stable running or low load conditions, the engine with direct injection design can enter Ultralean mode. Under this setting, the engine can only suck in air during the intake stroke, and the fuel injectors only supply fuel during the compression stroke, in order to achieve the effect of saving. According to actual tests, it can reach a ratio of oil to gas of up to 1:65. In addition to its amazing energy-saving performance, the overall power curve can also maintain a fairly high smoothness. However, this model will generate a considerable amount of NOx (sulfide) and high temperature. Fortunately, it has also been resolved due to breakthroughs in technology and material science.

CGI:CommonGatewayInterface

CGI stands for CommonGatewayInterface (Common Gateway Interface), which makes it possible to run external applications (or gateways) under a network server. The CGI-BIN directory is where CGI scripts are stored. These scripts enable WWW servers and browsers to run external programs without having to start another cause program.

It is a program running on a Web server and triggered by input from the browser. CGI is an interface for running external programs (or gateways) under an HTTP server. It allows network users to access usage-type programs on remote systems as if they were actually using those remote computers.

CGI allows viewers to interact with the server. If you have ever encountered filling out forms or searching on the Internet, it is most likely to be CGI.

Although CGI is easy to use, when a large number of people use a CGI application at the same time, the response will be slow and the speed of the web server will also be greatly affected. The advantage of CGI applications is that they can run independently.

CGI applications can be written in most programming languages, such as Perl (PracticalExtractionandReportLanguage), C\C++, Java and VisualBasic, etc. But for those webpage producers who don't have much programming experience, it is really a big problem.

The working principle of a CGI application is as follows:

⒈The browser requests the URL of the previous CGI application through an HTML form or hyperlink.

⒉The server sends and receives the request.

⒊The server executes the specified CGI application.

⒋CGI applications perform the required operations, usually based on the content entered by the viewer.

⒌The CGI application formats the result into a document (usually an HTML page) that the web server and browser can understand.

⒍The web server returns the result to the browser.

Notes about CGI applications are:

CGI applications run on a server system that can be requested by the browser, and the server CPU time and memory are required for execution. If there are thousands of such programs running at the same time, it will place extremely high demands on the server system. You must carefully consider this issue to prevent the server system from crashing.

Imperfect CGI applications may become a channel for others to enter the server system illegally, and may cause important information to be deleted or leaked.

The main purposes of CGI applications are as follows:

Send customized replies based on the HTML form filled in by the viewer.

Create a clickable thumbnail image.

Create a database where viewers can search for content.

Provide the interface between the server and the database, and convert the result into an HTML document.

Create dynamic HTML documents.

If a CGI script can do the same thing on every computer; writing the script will become easier. Unfortunately, CGI scripts depend on the server's operating system, so for non-UNⅨ servers, Prl (a common tool for scripting under UNⅨ) scripts is useless. Therefore, you must customize and install your CGI scripts.

Most servers provide CGI-BIN directories, but this is not enough. Because you should have your own CGI-BIN. In 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

Second, ASP: ActiveServerPages

ASP, Active Server Pages, is a programming environment in which , You can mix HTML, scripting languages, and components to create powerful Internet applications on the server side. If you have created a site before, which mixes HTML, scripting language, and components, you can add ASP program code to it. By adding script commands to the HTML page, 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 the ASP function is integrated into the Web site, the following things will happen:

1. The user calls out the site content, by default The extension of the page is .asp.

2. The browser requests the ASP file from the server.

3. The server-side script starts to run ASP.

4. ASP files are processed in the order from top to bottom, script commands are executed, and HTML page content is executed.

5. The page information is sent to the browser.

Because the script runs on the server side, the Web server sends a standard HTML page to the browser after completing all the processing. This means that ASP can only run on servers that can be supported. Another benefit of letting the script reside on the server side is that it is impossible for the user to see the code of the original script. What the user sees is only the final HTML content.

Three, PHP:PersonalHomePage

PHP is a server-side scripting language embedded in HTML. The difference between PHP and other client-side Javascript is that its code is executed on the server side. What can PHP do?

The lowest level, PHP can do anything other CGI programs can do, such as collecting table data , Generate dynamic page content, or send and receive cookies. Perhaps the most powerful and meaningful feature is that PHP supports a wide range of databases. Writing a database-supported Web page is incredibly simple.

The following is Currently supported databases:

AdabasDInterBaseSolid

dBasemSQLSybase

EmpressMySQLVelocis

FileProOracleUnixdbm

InformixPostgreSQL

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 and interact with other protocols.

PHP Brief history

In the fall of 1994, Rasmus Lerdorf began to conceive PHP. The early non-release version was used on his homepage to track who was viewing his online resume. The first version was released in early 1995. PHP is only considered as a personal homepage development tool. It consists of a very simple analysis engine that can only understand a few special macros and some common tools used in the backend of the homepage. Such as guestbooks, counters and other things. This The analyzer was rewritten in the middle of 1995 and was named the second edition of PHP/FI. FI comes from another package written by Rasmus to interpret data in html format. He combines a personal homepage tool script and a formal parser, And add mSQL support. This produces PHP/FI. PHP/FI grows at an amazing pace, and people start to contribute their code to it.

It is difficult to give its hard statistics 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. At this time, the development of PHP also changed. By Rasmus himself Preferences and projects developed by a few people turned into a more organized group achievement. ZeevSuraski and AndiGutmans rewrote the parser. This new parser became the basis of PHP version 3. Many useful codes were inherited from PHP/FI to PHP3 , And many of them were completely rewritten.

In mid-1999, no matter PHP/FI or PHP3 was bundled with many commercial products, such as C2-level strength Web servers and Red Hat Linux. According to NetCraft Inferred from the data, conservatively estimated to be applied worldwide PHP has more than 150,000 websites. From this point of view, it has more sites than Netscape's flagship corporate server running on the Internet.

~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CGI (CellGlobalIdentitier)

①The global cell identification code (CGI) is used to identify the area covered by a cell (base station/a sector cell)

②CGI is based on the LAI plus the cell identification code (CI)

③The structure is

MCC+MNC+LAC+CI

MCC: mobile country code

MNC: mobile network Code

LAC: location area number

CI: community identification code

where MCC\MNC\LAC is the location area identification (LAI)

CI is a 2Byte BCD code, which is determined by each MSC

Tento článek je ze sítě, nereprezentuje pozici této stanice. Uveďte prosím původ dotisku
HORNÍ