Thats a bit of a puzzle. What version of php are you using?
In your example, ob_end_flush() is not really required since an automatic flush will be done at the end of your script. But it still should work.
On your website, copy test.php to test.phps so we can look at the source. Might be some white space in there somewhere that you are just not seeing.