Php:cgi,fastcgi,php-fpm,mod_php,mod_cgi,mod_fcgid explanation

Source: Internet
Author: User

Some common concepts will be confused when they are not noticed, briefly listed below.


1. CGI is a universal Gateway interface, the HTTP server uses such an interface program to communicate with other applications (such as the PHP interpreter program), because CGI uses the fork and execution Way,

Each request requires a new CGI program to be processed, which results in poor performance.


2. FastCGI is a resident memory CGI, which is actually the process management of CGI programs, accepting requests through the master process, distributing them to worker processes, and prefork worker processes to reduce the overhead of CGI process creation, initialization, and destruction, thereby improving performance.


3. mod_php is Apache's built-in PHP interpretation module, using the Prefork way, do not need additional process to do communication and application interpretation, obviously mod_php than mod_cgi this way performance is much better, but the disadvantage is to bind the application and the HTTP server together, In addition, each Apache process needs to load mod_php regardless of whether the request is handling static content or dynamic content, which results in a waste of memory, a decrease in efficiency, and the need to restart the Apache server for php.ini file changes to take effect, which makes it impossible to make smooth configuration changes.


4. PHP-FPM is often used with the Nginx program, PHP-FPM is actually a implementation of the FASTCGI protocol, has been included in the PHP kernel, can be enabled by the--ENABLE-FPM compilation option, PHP-FPM supports configuration smoothing changes (by fork new worker processes), good performance and high memory efficiency, which is why NGINX+PHP-FPM's configuration combination overrides apache+mod_cgi and apache+mod_php.


5. Mod_fcgid is Apache's fastcgi implementation, and the performance is also very good, in the Apache 2.4 later version of the support.


Reference reading:

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 Cstopery

Php:cgi,fastcgi,php-fpm,mod_php,mod_cgi,mod_fcgid explanation

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.