Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经在我的 CentOs 6.5 中安装了 hhvm 3.5,它可以正常运行。但是我发现当我使用 pcntl_fork() 函数做某事时。
hhvm 将抛出一个错误
致命错误:在服务器模式下不允许分叉。
它只是在 nginx + hhvm 中发生,在 cli 模式下一切似乎都很好。pcntl_fork()只能在cli模式下运行吗?如果没有,如何让它好起来?
pcntl_fork()
错误消息对我来说很清楚:您不能在服务器(即 FastCGI)模式下分叉。
至于为什么,我只能猜想:php-fpm在单个进程中运行单个请求。HHVM 对请求进行了更复杂的多线程处理,这很容易使 fork 不能完全按照您的预期进行(如果您不仔细注意,通常会使事情处于奇怪或不一致的状态)。