HHVM can't use pcntl_fork

被刻印的时光 ゝ 提交于 2019-12-13 00:29:37

问题


I've install hhvm 3.5 in my CentOs 6.5, and it could be run correctly. But I found when I use pcntl_fork() function to do something.

The hhvm will throw an error as

Fatal error: forking is disallowed in server mode.

It's happened just in nginx + hhvm, in cli mode everything seems alright. Does the pcntl_fork() can only run in cli mode? If not, how to make it alright?


回答1:


The error message looks pretty clear to me: you cannot fork in server (i.e., FastCGI) mode.

As to why, I can only conjecture: php-fpm runs a single request in a single process. HHVM does much more complicated multithreaded handling of requests, which can easily make fork not quite do what you expect (and generally leave things in an odd or inconsistent state if you aren't carefully paying attention).



来源:https://stackoverflow.com/questions/28426255/hhvm-cant-use-pcntl-fork

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!