| Start |
|---|
| Multiprocessing using built-in fork functions You can use built-in functions to run PHP processes as forks. This is the most simple way to achieve parallel work if you don't need your threads to talk to each other. This allows you to put time intensive tasks (like uploading a file to another server or sending an email) to another thread so your script loads faster and can use multiple cores but be aware that this is not real multithreading and your main thread won't know what the children are up to. Note that under Windows this will make another command prompt pop up for each fork you start. master.php worker.php |
| Creating child process using fork PHP has built in function As you can see Another consideration here is a pnctl_wait suspends execution of parent process until the child process has exited. It is also worth noting that |
| Inter-Process Communication Interprocess communication allows programmers to communicate between different processes. For example let us consider we need to write an PHP application that can run bash commands and print the output. We will be using
After that we can simply use Always remember to close the child process by using proc_close() which will terminate the child and return the exit status code. |
Read Article
https://develop.horje.com/learn/1434/reference