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.