Answer the question
In order to leave comments, you need to log in
What is the way to implement forks in PHP?
Here I want to write the demon working in several flows. fork is unstable, exec somehow from "childhood" inspires the idea of a huge security hole. Maybe there are normal ways?
Is gearman good for flow control?
Answer the question
In order to leave comments, you need to log in
Fork is which pcntl_fork? I implemented it somehow with the help of its multithreading, no problems were noticed.
Had the same goal. I recommend reading: habrahabr.ru/blogs/php/40432/
fork from pcntl_fork is just as unstable as a normal Cish fork. No more, no less.
In child processes, we control the fall on any error, including an interpreter error, and correctly terminate the process with a return code.
We analyze the return code in the parent process to determine whether the hamster died of natural causes or was torn from a drop of nicotine.
You can use the mind of your predecessors and use ready-made solutions: phpdaemon.net/
With proper skill and no fear of rebuilding php, this thing will not only prefork the required number of workers, but also do hot code replacement right at runtime.
Or nanoserv.si.kz/ - a little easier, clearer for starters, but for 70% of tasks it will be enough
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question