I'm running a php script from the command line on my windows computer, I'm using this to run it:
php "c:\phpd\www\file.php" > log.txt

Its working as I wanted except that the output is only saved in the log.txt file when my script is stoped, what I want is to have the output saved in log.txt in real time as what happens when I run the same script on a linux box.