I am currently trying to implement a job queue in php. The queue will then be processed as a batch job and should be able to process some jobs in parallel.
I already
I prefer exec() and gearman. exec() is easy and no connection and less memory consuming. gearman should need a socket connection and the worker should take some memory. But gearman is more flexible and faster than exec(). And the most important is that it can deploy the worker in other server. If the work is time and resource consuming. I'm using gearman in my current project.
First of all, this answer is based on the linux OS env.
Yet another pecl extension is parallel,you can install it by issuing pecl install parallel
,but it has some prerequisities:
extension=parallel.so
to itthen see the full example gist :https://gist.github.com/krakjoe/0ee02b887288720d9b785c9f947f3a0a or the php official site url:https://www.php.net/manual/en/book.parallel.php