Output buffering is allready in use and is what's causing your echos to not appear in the browser. Web servers usually use output buffering (PHP output buffering is a separate thing). Read the documentation and or configuration files for your webserver to find out how big the output buffer is, or try sizes of 1024, 4096, 8192 until you fill it.
What you need to do to make your approach work is
echo str_repeat(' ', $web_server_buffersize - $content_length_so_far);
Or you could output the entire webpage, with info about work being done in the background and then use pcntl_fork to spawn a child process, setsid the child and let the initial process exit, then finish the work in the child which has now become session leader.
If you use some way of tracking progress, such as doing updates to a database, then you can even have the web page reload via meta refresh or javascript window.setTimeout to keep the user informed of the progress, and once the work is complete, change the contents or perform a redirect, whichever suits your needs.