cgi,fastcgi,php-cgi,php-fpm,spawn-fcgi

Source: Internet
Author: User
Tags fpm

Cgi
    • CGI, Common Gateway Interface, is a tool for HTTP Server-to-contact with programs in other servers, which can used into any languages with standard input, standard output and environmental variables, such as PHP, Perl, or TCL.
FastCGI
  • FastCGI is a kind of the CGI which is long-live, which'll always be running. With FastCGI, it's ll take less time T fork(which is a problem of Fork-and-execute mode in CGI). In additional, FastCGI also supports for distributed computing.
  • it is Also, which are an opened Extension of CGI, which is used to keep CGI running in the memory. It's well-known That loading of CGI have been the main reason of low performance .

  • the main process of running FastCGI:

    1. Loading the Process Manager of FastCGI when a WEB server has booted (IIS ISAPI or Apache Module)
    2. the Process Manager of FastCGI would initiate itself to create several CGI processes, which is used to wait for Connec tion of WEB servers.
    3. when requests from clients has reached the WEB server, the Process Manager of FastCGI would select a CGI set up before To connect, whose environmental variables and standard input would be a sent to the sub process  php-cgi &NB Sp;of FastCGI.
    4. this Sub process would return standard output and error info to the WEB server with the SA Me connection . Requests is finished when it closes the connection.
  • Therefore, FastCGI only set once for parsing php.ini , loading extensions and initiating all the data structures.
Shortcuts
    • Because of multi-processes, FastCGI would cost more memory than CGI, whose each process (php-cgi) would cost about 7 Mb to 25Mb memory.
  • Data from the Article:nginx 0.8x + PHP 5.2.13 (FastCGI) is the Times better than Apache (Edition 6)
  • When 30k connection happens in parallel, Nginx processes would only cost 150Mb Mem (15Mb ), and php-cgi would onl Y cost is about 1280Mb (20Mb 64).
php-cgi
    • PHP-CGI is one kind of the Process Manager of FastCGI, which is within PHP itself.
    • The command to boot is as follow:
php-cgi -b 127.0.0.1:9000
Shortcuts
    • After changing php.ini , you should reboot php-cgi the new work php.ini .
    • When a php-cgi process was killed, all the PHP code would cannot run. (PHP-FPM and spawn-fcgi do not have the same problem)
PHP-FPM (fast-cgi Process Manager)
    • PHP-FPM is another kind of the Process Manager of FastCGI, which can be downloaded here.
    • It's actually a patch for PHP, which are used to integrate the Process Manager of FastCGI into PHP, which should b e make into PHP before version 5.3.2 (5.3.2 has been integrated in PHP later).
    • PHP-FPM can used to control sub processes of php-cgi:
/usr/local/php/sbin/php-fpm [options]# options# --start:      start a fastcgi process of php# --stop:       force to kill a fastcgi process of php# --quit: smooth to kill a fastcgi process of php# --restart: restart a fastcgi process of php# --reload: smooth to reload php.ini# --logrotate: enable log files again
spawn-fcgi
    • SPAWN-FCGI is a general kind of the Process Manager of FastCGI, which are one part of LIGHTTPD.

cgi,fastcgi,php-cgi,php-fpm,spawn-fcgi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.