I have a PHP script like this:
foreach ($items as $item) {
if ($condition) {
shell_exec("php background.php > /dev/null 2>/dev/null
&");
}
}
The background script takes about 10 seconds and is supposed to be run in parallel every time the if statement is true. The problem is that, although generally it goes just as planned, sometimes background scripts just don't execute completely. Is there any limit to parallel execution like this and if there is, is it a normal behaviour for the server to kill one process to execute another?
UPD: Btw, if I strengthen the condition, reducing the number of simultaneous processes, everything works like a charm.