I'm running php-fpm and I'd开发者_如何转开发 like to shutdown and respawn php children without restarting php itself.
Actually, there is by using pcntl functions, pcntl_fork() in particular would be your friend for this..
You can find many code examples on this page.
Trivial example:
$pid = pcntl_fork();
if($pid) {
// parent process runs what is here
print "parent\n";
}
else {
// child process runs what is here
print "child\n";
}
// outputs:
child
parent
This is as simple as it gets, in real life you have a bit more to check for than this, do look at pcntl section on php.net, and a few of the code examples on the page I posted you. Hope that gets you on the right track, happy coding.
精彩评论