How to call the child script concurrently without waiting for the PHP parent script

Source: Internet
Author: User
How does the PHP parent script concurrently call the child script without waiting? I have compiled a PHP system and need to call 1.php and 2.php in the parent script father. php. 1. php, 2.php, these two subscripts are executed for a long time and cannot affect 2.php and father because 1.php is called. how can I concurrently call the child script without waiting for execution of normal scripts in php?
I have compiled a PHP system and need to call 1.php and 2.php in the parent script father. php.

1. php, 2.php, these two subscripts are executed for a long time and cannot affect the execution of normal scripts in 2.php and father. php because 1.php is called.

I mean, when the parent process is father. php calls 1.php, 1. php will be executed in the background, but father. the php script is still executed to call 2.php, so that 2. php is also executed in the background, after calling 2. after php, father. php code continues to be executed. at this time, 1.php and 2.php are also concurrently executed in the background.

Instead of using father. php to call 1.php, wait until the execution of 1.php is complete before calling 2.php. wait until the execution of 2.php is complete before executing the subsequent code.

To sum up, the external script is called concurrently and executed in the background of the called Script. the parent script continues to run normally without waiting for the child script.

Do I understand? Thank you.

------ Solution --------------------
Yes. search for php execution in the background.
------ Solution --------------------
Use pcntl_fork to generate a sub-process and execute it in the sub-process.
------ Solution --------------------
Write a shell to call the function.

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.