CGI stands for Common Gateway Interface, which allows a client to request data from a web browser to a program running on a web server. CGI describes a standard for transmitting data between a client and the program. One of the purposes of CGI is to be independent of any language, so CGI can be written in any language as long as the language has standard input, output and environment variables, such as php, perl, tcl, etc. FastCGI is a protocol for communication between web servers and processing programs. It is an improvement on CGI. FastCGI is like a long-live CGI. It can be executed all the time. When a request arrives, it will not take time to fork a process to handle it (this is the most criticized fork-and-execute mode of CGI). Because it is just a communication protocol, it also supports distributed computing, that is, FastCGI programs can be executed on hosts other than web servers and accept requests from other web servers. FastCGI is a language-independent, scalable open extension of CGI that keeps the CGI interpreter process in memory to achieve higher performance. Repeated loading of CGI programs is the main reason for poor CGI performance. If CGI programs are kept in memory and scheduled by the FastCGI process manager, good performance, scalability, and fail-over features can be provided. In general, the entire workflow of FastCGI is as follows:
PHP's CGI implements the Fastcgi protocol. It is a TCP or UDP protocol server that accepts requests from Web servers. When it starts, it creates a TCP/UDP protocol server socket listener and receives related requests for processing. Then it enters the PHP life cycle: module initialization, sapi initialization, processing PHP requests, module shutdown, sapi shutdown, etc., which constitute the entire CGI life cycle. Taking TCP as an example, on the TCP server side, the following steps are generally performed:
PHP FastCGI enables all of your PHP applications to run through mod_fastci instead of mod_phpsusexec. FastCGI applications are fast because they are persistent and do not have to be started and initialized for every request. This makes it possible to develop applications that would otherwise be impractical in the CGI paradigm (such as a large script, or an application that needs to connect to single or multiple databases). Advantages of FastCGI:
But there are potential problems:
|
<<: The third round of the Aite Tribe Story Collection with prizes has begun~
Part 1: Primitive Spinning Throughout the history...
Part 01 introduction The history of computer deve...
[[376707]] The Android system has now entered the...
January 5 (Reporter Zhang Xiaodong) The end of 20...
【appendix】 1. When a factory produces bottled bev...
The absence of the iPhone 6 from the mainland was...
[[120832]] As one of the greatest and most import...
Have to say On the subject of sun protection Whet...
Qilian Mountain National Park, Qinghai Province R...
In general, the quality of content on Double Elev...
Advertising is a barometer of economic developmen...
The core task of attracting new users is to promo...
With the ability to quickly and accurately proces...
Monitoring data on mortgage interest rates of 533...