Reputation: 69
Do you know any library that eases work with processes, signal sending etc? Thank you in advance!
EDIT: We're doing some data loading from external sources in PHP daemon. We want to split PHP process to have:
Upvotes: 2
Views: 1520
Reputation: 3982
You can use process control library, but it works only on linux.
For fork
purposes it contains pcntl_fork
function. Example:
$pid = pcntl_fork();
if ($pid == -1) {
die('could not fork');
} else if ($pid) {
// we are the parent
pcntl_wait($status); //Protect against Zombie children
} else {
// we are the child
}
UPD: if I correct understand your goals you design your application without forking of processes. You can use two daemons where first daemon will process data source and add it to queue. The second daemon will track the queue and process it.
P.s. As I know php can not fork processes on windows platforms. Also for additional you can use POSIX function in php.
Upvotes: 2