On Reddit.com there's a post from krakjoe talking about using multithreating in PHP, specifically with pthreads. Unfortunately, there's several misconceptions about the pthreads (and concurrency) that still makes it difficult in PHP. The post lists a few of them:
- PHP is not thread safe, there are lots of extensions that will give your application cooties.
- pthreads is old fashioned
- pthreads does not include everything you need to execute safely
- pthreads unsafely shares memory among contexts in order to provide concurrent functionality
- pthreads is beta and should be avoided at all costs
The author points out that pthreads are still in more of a "beta" state and probably shouldn't be used in production (though some do):
Multi-threading in PHP sounds like some sort of voodoo, for so long it's been something that was either impossible in the minds of php programmers, or a bad idea to try and emulate. pthreads doesn't emulate anything, it leverages bundled functionality and the object API to provide true userland multi-threading.