Question

I am playing with pcntl_fork() in PHP.

I took the class that is written in the second comment, and tried to send data to it - which seems to work fine.

Now I did some processing on that data, and would like to receive some results in my parent process.

Does anyone know how this can be done ? The only way I can think of doing this is to store the information in the database and/or other storage.

Was it helpful?

Solution

Having worked with pcntl fork in a number of projects i do not believe there is any way to send data back to the parent process directly. You would be able to do this via the database as you have already mentioned however you may be better off using PHP's shared memory components (http://php.net/manual/en/book.shmop.php) or memcache for this purpose.

Can you elaborate on what you are doing, it may be that you can avoid this requirement.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top