YII Multi-thread - multi-task

Some applications need to perform several tasks that may take a while to finish. When there are many tasks to execute, it may take a long time to finish all of them if they are executed sequentially, i.e. one after another.

A possible solution for this problem is to execute several tasks at the same time using separate processes or threads.

PHP has the pcntl extension that can be used to run multiple processes in parallel. However, this extension is only available in Linux or Unix like operating systems.

Can YII handle/work native this Multi-thread way?



I don't think this falls in the scope of a PHP framework.

Another approach would be to make asynchronous AJAX calls which do the processing. It would be multi-threaded (as it would spawn a new httpd/php process) and you could create a callback to be notified upon completion if necessary.


use ajax to hanlde internal task:


Not quite what I had in mind but if it works…