Using Pcntl_fork to create a subprocess in PHP-FPM connection mode, the simplest piece of code is as follows:
Output 6 '-' in CLI mode, but only 2 '-' in PHP-FPM connection mode, that is, only the results of the main process or a child process can be output when the PHP-FPM is connected. How can I get all the output under the PHP-FPM, or where is the output of php-fpm under PHP? Has anyone ever met this problem?
Reply content:
Using Pcntl_fork to create a subprocess in PHP-FPM connection mode, the simplest piece of code is as follows:
!--? phpfor ($i = 0; $i 2; $i + +) {pcntl_fork (); Print_r ('-');} The Outputs 6 '-' in CLI mode, but only 2 '-' is output in PHP-FPM connection mode, which means that only the results of the main process or a child process can be output when the PHP-FPM is connected. How can I get all the output under the PHP-FPM, or where is the output of php-fpm under PHP? Has anyone ever met this problem?
has not encountered it. I use the apt-get installed under Ubuntu php-fpm default is to disable the Pcntl module, also put these functions are written in the disabled_functions inside. The
PHP-FPM itself has a management process that should not have used this function, otherwise the behavior would be uncertain, for example, the management process might kill too many processes.
Pcntl_fork is only under the CLI, PHP-FPM does not support, to do so, you can php-fpm down the system method or Popen method to execute a CLI program