What is the relationship between php-cli and php-fpm?

Source: Internet
Author: User
Tags zts
What is the relationship between php-cli and php-fpm? There is also a php-zts, which Baidu calls "thread security edition ". So which of the three things should be used? Can you talk about their application scenarios separately? What is the relationship between hub.docker.com _ php-cli and php-fpm?
There is also a php-zts, which Baidu calls "thread security edition ".
So which of the three things should be used? Can you talk about their application scenarios separately?
Https://hub.docker.com/_/php/

Reply content:

What is the relationship between php-cli and php-fpm?
There is also a php-zts, which Baidu calls "thread security edition ".
So which of the three things should be used? Can you talk about their application scenarios separately?
Https://hub.docker.com/_/php/

CLI is a command line version.
FPM is an extension for processing PHP files as server software such as Apache or Nginx.

The default PHP version does not support thread security. For this thread security issue, you can learn about PHP extension development. This is because of the C language problems.

Cli and fpm are two ways to run php, and thread security and non-thread security should be described as the version above. Whether to enable thread security can be selected during PHP compilation.

For a simple understanding, cli is used to run PHP In the command line, and fpm is used for web access.

Cli is the php Command we use in the command line. In fact, it can also provide HTTP Services, because it has a built-in HTTP Server:

php -S 127.0.0.1:80 -t /www /www/index.php

In this way, a single-process HTTP service listening for port 80 on 127.0.0.1 with the root directory/www is established, which can be used for PHP development and testing.
Here, index. php is a rewrite rule, which can be implemented using PHP, for example:


  

The above PHP code is similar to the Nginx Rewrite Rules Using index. php as the front-end controller (Routing) framework.

location / { try_files $uri $uri/ /index.php?$args;}

Php-fpm is a multi-process FastCGI service with built-in php interpreter, resident process Background, built-in Process Manager, support process pool configuration, and mostly used with Nginx.

PHP compiled on Linux is non-thread-safe by default. When does thread security need to be implemented?
For example, if you want to use the pthreads PHP multi-thread PECL extension,
Or your PHP runs in a multi-threaded container, such as Apache event MPM, which is a multi-threaded MPM.

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.