Possible Duplicate:
How can one use multi threading in php applications
Does anybody know whether or not PHP5 supports multi threading? If it does, how to implement that?
When using php as a module (like in apache), it's not possible. If you use php in CLI, you can use the function pcntl_fork
While you can use the pcntl extension to fork, please don't. It creates all sorts of entertaining issues, especially when you're using mod_php.
There are better ways. Try a work queue, like Gearman.
精彩评论