更新时间:2023-01-18 23:14:02
我们已经构建了一个系统,可以或多或少地满足您的需求.所以,绝对可以用 PHP 构建一个多进程应用程序.
We have build a system that does more or less what you want. So, it is definitely possible to build a multi-process application in PHP.
然而,这并非微不足道.如果您fork 一个子进程,您需要非常小心管理您的远程连接以避免出现问题.(使用 socket_* 系列函数而不是 fsockopen 更好的控制)
It is however, not trivial. If you fork off a child process, you need to very carefully manage your remote connections in order to avoid problems. (use the socket_* family of functions instead of fsockopen for better control)
此外,信号往往会中断您的正常程序流程.这当然是正常的,但 PHP 的构建并没有考虑到这一点 -> 为一些意想不到的结果做好准备.
Also, Signals, tend to interrupt your normal program flow. This is off course normal, but PHP was not build with this in mind -> be prepared for some unexpected results.