run.php
当我从浏览器运行一次时,我不明白为什么会有超过 1 个进程
在 PHP 代码中,我有以下内容:
运行.php
<?php
shell_exec("php theprocess.php > /dev/null 2>&1 &");
?>
进程.php
<?php
$z = 1;
while ($z <= 20) {
echo $z . "\n";
$z++;
sleep(3);
}
?>
我从浏览器执行 run.php (例如:http://localhost/run.php)
然后我输入:ps aux | grep php
username@ [~]# ps aux | grep php
username 27272 0.0 1.5 89504 64468 ? R 17:33 0:00 php theprocess.php
username 27274 0.0 1.2 89504 49872 ? R 17:33 0:00 php theprocess.php
username 27276 0.0 0.6 89504 28676 ? R 17:33 0:00 php theprocess.php
username 27278 0.0 0.0 22280 3704 ? R 17:33 0:00 php theprocess.php
username 27280 0.0 0.0 1940 508 ? S+ 17:33 0:00 grep php
我不明白为什么它显示超过 1 个 theprocess.php 进程?
还有为什么它还在后台运行?它应该终止theprocess.php
完成任务。怎么可能呢?