process-control

PHP: What does pcntl_fork() really do?

时间秒杀一切 提交于 2019-11-30 14:46:46
问题 PHP's pcntl_fork function is supposed to fork a process just as the standard fork function in C. But I was wondering if this function really forks the process or if it emulates that behavior in a different way. If it really forks the process then it's clear which process that is: one of Apache's child processes. That's OK as long as Apache is using the prefork MPM (i.e. one process per request). But what does happen if Apache is using the worker MPM?? When the worker MPM is being used, every

PHP: What does pcntl_fork() really do?

耗尽温柔 提交于 2019-11-30 11:43:24
PHP's pcntl_fork function is supposed to fork a process just as the standard fork function in C. But I was wondering if this function really forks the process or if it emulates that behavior in a different way. If it really forks the process then it's clear which process that is: one of Apache's child processes. That's OK as long as Apache is using the prefork MPM (i.e. one process per request). But what does happen if Apache is using the worker MPM?? When the worker MPM is being used, every Apache child process contains many threads, each one handling a different HTTP request. So if you would

PHP Daemon/worker environment

巧了我就是萌 提交于 2019-11-28 03:36:43
Problem: I want to implement several php-worker processes who are listening on a MQ-server queue for asynchronous jobs. The problem now is that simply running this processes as daemons on a server doesn't really give me any level of control over the instances (Load, Status, locked up)...except maybe for dumping ps -aux. Because of that I'm looking for a runtime environment of some kind that lets me monitor and control the instances, either on system (process) level or on a higher layer (some kind of Java-style appserver) Any pointers? Here's some code that may be useful. <? define('WANT