rror @PHP: ob_flush () [ref.outcontrol]: error al vaciar el búfer. No hay buffer para vaciar

¿Podría alguien guardar estos 2 archivos y ejecutarlos y decirme por qué me sale el error "ob_flush () [ref.outcontrol]: error al vaciar el búfer. No hay búfer para vaciar". Intenté buscar en Google y dice que tengo que usar ob_start (); pero cuando lo hago, no se imprime línea por línea, sino que devuelve todo el objeto del bucle FOR cuando se ha completado. Soy un poco nuevo en PHP, así que no estoy seguro de dónde buscar ...

test_process.php

// This script will write numbers from 1 to 100 into file
// And sends continuously info to user
$fp = fopen( '/tmp/output.txt', 'w') or die('Failed to open');
set_time_limit( 120);
ignore_user_abort(true);

for( $i = 0; $i < 100; $i++){
    echo "<script type=\"text/javascript\">parent.document.getElementById( 'foo').innerHTML += 'Line $i<br />';</script>";
    echo str_repeat( ' ', 2048);
    flush();
    ob_flush();
    sleep(1);
    fwrite( $fp, "$i\n");
}

fclose( $fp);

main.html

<html>
    <head>
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" charset="utf-8"></script>

        <style type="text/css" media="screen">
            .msg{ background:#aaa;padding:.2em; border-bottom:1px #000 solid}
            .new{ background-color:#3B9957;}
            .error{ background-color:#992E36;}
        </style>

    </head>
    <body>

        <iframe id="loadarea" width="1024px" height="768px"></iframe><br />
        <script>
            function helper() {
                document.getElementById('loadarea').src = 'test_process.php';
            }
            function kill() {
                document.getElementById('loadarea').src = '';
            }
        </script>

        <input type="button" onclick="helper()" value="Start">
        <input type="button" onclick="kill()" value="Stop">
        <div id="foo"></div>


</body>
</html>

Respuestas a la pregunta(6)

Su respuesta a la pregunta