I started the process in the background on an Apache Windows server.
index.php after that:
<?php
$cmd = "C:/xampp/php/php.exe -f test.php";
pclose(popen("start /B ". $cmd, "r"));
echo "OK";
?>
test.php after that:
<?php
sleep(5);
file_put_contents("1.txt", date("Y-m-d H:i:s"));
?>
At that time I want to get the pid, which php -f test.php. When I run index.php, I can see the new php.exeprocess at the command prompt tasklist. How can I get the pid for this background process.
Thank.
source
share