Note that you *have* to do a read on the handle before you can feof(), even if the command outputs nothing! So..
<?php
$f=popen("sleep 2","r");
while (!feof($f)) {}
pclose($f);
print "done";
?>
will never finish.
Note that you *have* to do a read on the handle before you can feof(), even if the command outputs nothing! So..
<?php
$f=popen("sleep 2","r");
while (!feof($f)) {}
pclose($f);
print "done";
?>
will never finish.