PHP-FPM than PHP becomes Apache module fortunately

Source: Internet
Author: User
Tags fpm vps microsoft iis

php-fpm than PHP becomes Apache module fortunatelyTime 81kgps61 | Browse 1896 times | Report I have a better answer.recommended for 2017-11-23 10:46:09 Best Answer
Overview
Write this article is because today to build LNMP environment under Ubuntu, Nginx use is PHP-FPM, so the Web server and PHP interpreter interactive way to do a collation.
As we all know, PHP is a cross-platform, cross-server language, which is one of the reasons why it is so popular. However, few people know that the PHP interpreter can run in a different way on the Web server. PHP is most commonly used in the form of a module (mod_php) in Apache, and Apache is the default way to run PHP. But in Nginx, Nginx also uses PHP-FPM.
This article on these concepts to do a description, if there is no place, please criticize the advice.
What is a PHP processor (PHP handlers)?
The first thing to remember is that any kind of Web server (Apache, nginx, etc.) is designed to send users static resources such as HTML, images, Web server itself does not explain any dynamic script (PHP, Python, etc.). The PHP processor is used to interpret the PHP code in the Web application and interpret it as HTML or other static resources, then pass the result of the resolution to the Web server and finally to the user by the Web server. Most Web servers cannot parse PHP code, so it requires a program that can parse the PHP code, which is the PHP processor.
mod_php
First, take a look at the Apache module to run PHP. Mod_php is now available in every version of the Linux software repository and is therefore easy to install.
When PHP is running as a module in Apache, the PHP interpreter is "embedded" in the Apache process. Apache does not invoke any external PHP processes, so this way makes Apache and PHP better able to communicate. However, when PHP is running in this way, even if Apache provides only static resources (such as HTML), each Apache sub-process will also load mod_php, resulting in more memory overhead than normal.
Another disadvantage of running in this way is that it works only with Apache. In addition, in small VPS and large sites, this approach is not appropriate, because large sites may have a lot of static resources, and these static resources do not need PHP program interpretation.
Advantages:
1. Easy to install and update
2. Capacity Configuration
Disadvantages:
1. Can only work with Apache
2. Increased Apache child process memory overhead
3. When you change the php.ini file, you need to restart Apache
FastCGI
FastCGI is a common protocol interface between interactive programs and Web servers, and is a variant of the early CGI (Common Gateway Interface). Compared to CGI, fastcgi reduces the overhead of interacting with the Web server while processing more requests at a time.
Apache can use fastcgi in the form of mod_fcgid. Other Web servers, such as LIGHTTPD, Nginx, Cherokee, and even Microsoft IIS, can also use fastcgi. With fastcgi, you can set up multiple versions of PHP at the same time, which is useful in some cases.
FastCGI also uses suEXEC to support different users with their own instance of PHP. This feature is especially important for improving security in a shared environment. FastCGI also reduces the memory overhead of the Web server while guaranteeing performance.
Advantages:
1. Compatible with most Web servers
2 Less memory than mod_php
3. More configuration items, including multiple versions of PHP and suEXEC
Disadvantages
1. Complex configuration
2. Not known by everyone
PHP-FPM (FastCGI Process Manager)
PHP-FPM is an up-to-date way for Web servers to use PHP and is another implementation of PHP fastcgi. The PHP-FPM is very useful for Web applications running on small VPS and multiple servers. It can also be used by any Web server that is compatible with fastcgi.
PHP-FPM enables administrators to gracefully stop and start a PHP worker process without losing any queries. This allows us to incrementally update the configuration and the binaries without losing any queries. It also allows us to urgently restart the process in the event of any accidental damage.
Advantages:
1. Compatible with most Web servers
2 Less memory than mod_php
3. More configuration items, including multiple versions of PHP and suEXEC
Disadvantages
1. Complex configuration
2. Not known by everyone
Add: Apache four ways to run PHP
mod_php (dso,dynamic Shared Object)
Cgi
suphp
FastCGI
Summarize
The content is relatively abstract, the understanding is not deep, the record leaves for later reference ~:)
This answer is recommended by netizensReport | Answer Correction | Comments (3) 0

573767859 | Huiyulong

Good at: internet

recommended for you:

PHP-FPM than PHP becomes Apache module fortunately

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.