Reputation: 11
I am working in a IIS server with php7.3 and My code segment looks like this
<?php
fclose(popen("start /B php C:\\mydir\\exec.php", "r"));
?>
Code segment of "exec.php" is given below (actual code executes a long process of joining tables and exporting as a csv file). I need "exec.php" to be run in background without being waiting for its completion.
<?php
$f = fopen("text" . date("H_i_s") .".txt","w");
fwrite($f,"test");
fclose($f);
?>
These segments runs just fine when I remove "start /B", but not with it.
Upvotes: 1
Views: 138
Reputation: 3804
It appears that start /B command
solely doesn't not trigger the process.
You could try start /B command > NUL 2>&1
It worked in one of my case without understanding why.
Upvotes: 0