PHP中外部程序的实时输出

I've written and compiled a command line program (abc.exe) that runs for about 10 mins, makes some calculations and outputs 1 line of results per 10 secs, like this:

C:\>abc.exe
Result 1
Result 2
Result 3
.
.
.

The following php script should theoretically show these results in real time, as they are produced by the program.

<?php 
$a = popen('abc.exe', 'r');
while($b = fgets($a)) { 
echo $b."<br>
"; 
ob_flush();flush(); 
} 
pclose($a); 
?>

However, I just get all the results at the end of the execution of the program. Why could this be happening?
Please note that if I replace abc.exe with ping 8.8.8.8 or tracert 8.8.8.8, the script works like a charm. Please, help me, I've tried everything that is suggested in similar questions here, but nothing seems to work!