Sharing of php-fpm and pcntl_fork

Source: Internet
Author: User
Use pcntl_fork to create a sub-process in php-fpm connection mode. The simplest code is: {code ...} 6 '-' is output in cli mode, but only 2 '-' is output in php-fpm connection mode '-', that is, only the results of the main process or a sub-process can be output during the php-fpm connection. How can I use pcntl_fork to create a sub-process in php-f... php-fpm connection mode? The simplest code is as follows:

 

6 '-' is output in cli mode, but only 2 '-' is output in php-fpm connection mode '-', that is, only the results of the main process or a sub-process can be output during the php-fpm connection. How can I get all the output in php-fpm or where is the output in php-fpm? Has anyone ever encountered this problem?

Reply content:

In php-fpm connection mode, use pcntl_fork to create a sub-process. The simplest code is as follows:

  

6 '-' is output in cli mode, but only 2 '-' is output in php-fpm connection mode '-', that is, only the results of the main process or a sub-process can be output during the php-fpm connection. How can I get all the output in php-fpm or where is the output in php-fpm? Has anyone ever encountered this problem?

Never met. In ubuntu, php-fpm installed with apt-get is disabled by default for the pcntl module, and all these functions are written into disabled_functions.

Php-fpm has a management process on its own and should not have used this function. Otherwise, the behavior will be uncertain. For example, the management process may kill too many processes.

Pcntl_fork is only available under cli, and php-fpm is not supported. To do so, you can downgrade the system method or popen method in php-fpm to execute a cli program.

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.