PHP-FPM and Pcntl_fork shared issues

Source: Internet
Author: User
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

  • Related Article

    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.