It looks like [man]pcntl_fork[/man] can simulate multithreading/multiprocessing. I am looking to use it with websockets, and in case anyone should ask this is much more complex than a simple chat room or a stock ticker. So I figure planing ahead is better than being left standing with your head in your hands, in the event things get a bit crazy, which is the hope.
So to my questions. While looking for that answer I ran across several places that thought, for a large number of concurrent connections, where response times is important, PHP isn't the best choice. Now response time can be handled by just spawning (forking) more child process, the problem seems to be more of resource usage which could eventually lead to a response time issue (if hosting maximums are reached), or at the very least a lot of unnecessary cost (for purchasing extra resources).
So first, I am wondering if [man]pcntl_fork[/man] is the best route or if there are other functions or techniques I should explore?
Second, I am wondering at what point should one look to other languages? I guess that is kind of server related, which can vary greatly, but maybe there's a rule of thumb, or such.
And then if I do need to look at a different language (Perl, Ruby, Python, C++, ect), which ones maybe best suited to compliment PHP? As I do not plan to leave PHP anytime soon.
I guess it is possible that what I read was a lot of hot air or half truths, and if so that information would also be much appreciated, as then I can go with my original plan.