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~
At 10:44 a.m. Beijing time on June 5, 2022, the L...
Half is flame, and the other half may also be fla...
With the progress of the times and the developmen...
Hunter Camp high traffic website makes money in 2...
[[145610]] There are many articles about App prom...
The industry has always had different views on the...
How can we use data to clearly profile existing u...
Under years of pressure from the international co...
Olympic medals are rusty! The Paris Olympics is o...
At the recently concluded MWC2016, VR once again ...
An activity is generally divided into four parts ...
Last week, we conducted a violent evaluation of t...
After using our eyes for a long time, our eyes wi...
When it comes to the Internet industry, many peop...
Recently, #Pimple vaccine# has become a hot topic...