I tried flush() just before ob_start(), but to no avail. It just doesn't work for me.
Basically the purpose of running output buffering is because the $file is a php file that gets parsed (and executes), and is then assigned (as a string) to $fp.
That's why I'm doing it this way.