I have a script which do multiple actions in longer time. In standard situation output from PHP script is sent after full execution of this script. Use
Try calling in every loop ob_flush and ob_clean. The first one send the output buffer and the second one erase it.