In the PHP code, I have the following:
run.php
<?php
shell_exec("php theprocess.php > /dev/null 2>&1 &");
?>
I execute run.php from the browser (eg: http://localhost/run.php)
Then I typed: ps ux
username [~/www/site/test]# ps ux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
username 847 0.0 0.1 23808 7724 ? R 16:55 0:00 php theprocess.php
username 849 0.0 1.2 89504 53244 ? R 16:55 0:00 php theprocess.php
username 851 0.0 0.7 89504 31592 ? R 16:55 0:00 php theprocess.php
username 853 0.0 0.1 23628 4636 ? R 16:55 0:00 php theprocess.php
username 854 0.0 0.0 2276 824 ? R+ 16:55 0:00 ps ux
username 3880 0.0 0.0 10080 1704 ? S 16:33 0:00 sshd: username@pts/2
username 3883 0.0 0.0 2676 1368 ? S 16:33 0:00 -jailshell
I dont understand why is it showing more than 1 theprocess.php process? I have only executed 1 time. I did not execute more than 1.
Edit:
Also why it still running at the background? it should terminate theprocess.php finish the task.