PHP: CGI, FASTCGI, php-fpm, mod

Source: Internet
Author: User
Some common concepts may be confused when you do not pay attention to them. 1. CGI is a common gateway interface. The HTTP server uses this interface program to communicate with other applications (such as PHP interpreter programs). Because CGI adopts the forkandexecution method, each request requires a new CGI program for processing, resulting in low performance. 2. FA

Some common concepts may be confused when you do not pay attention to them. 1. CGI is a common gateway interface. The HTTP server uses this interface program to communicate with other applications (such as PHP interpreter programs). Because CGI adopts the fork and execution method, each request requires a new CGI program for processing, resulting in low performance. 2. FA

Some common concepts may be confused when you do not pay attention to them.


1. CGI is a common gateway interface. The HTTP server uses this interface program to communicate with other applications (such as PHP interpreter programs). Because CGI adopts the fork and execution method,

Each request requires a new CGI program for processing, resulting in low performance.


2. FASTCGI is the resident memory CGI. It is actually the Process Management of the CGI program. It accepts requests through the master process and distributes the requests to the worker process. It can also prefork worker processes, reduces the overhead of CGI process creation, initialization, and destruction to improve performance.


3. mod_php is the built-in php interpretation module of apache. It uses the prefork method and does not require additional processes for communication and application interpretation. Obviously, mod_php has much better performance than mod_cgi, however, the disadvantage is that the application and the HTTP server are bound together. In addition, every Apache process needs to load mod_php, regardless of whether the request processes static content or dynamic content, which leads to a waste of memory, efficiency is reduced. In addition, php. changes to the INI file can take effect only after the apache server is restarted, which makes smooth configuration changes impossible.


4. php-fpm is a commonly used program with nginx. php-fpm is actually an enhanced implementation of the FASTCGI protocol and has been incorporated into the PHP kernel, you can use the -- enable-fpm compilation option to enable it. php-fpm supports smooth configuration changes (through the fork new worker process) with good performance and high memory usage efficiency, this is why the configuration combination of nginx + php-fpm replaces apache + mod_cgi and apache + mod_php.


5. mod_fcgid is the fastcgi Implementation of apache and has good performance. It is supported in Versions later than apache 2.4.


Refer:

Http://httpd.apache.org/mod_fcgid/

Http://www.openlogic.com/wazi/bid/209956/mod_php-vs-FastCGI-vs-PHP-FPM-for-Web-Server-Scripting

Http://www.eschrade.com/page/why-is-fastcgi-w-nginx-so-much-faster-than-apache-w-mod_php/

Http://serverfault.com/questions/6733/php-what-are-the-advantages-of-fastcgi-over-mod-php


By iefreer

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.