Allowing PHP to "echo" as the Script Runs
<p>Consider the following, very simple PHP code:</p>

<pre><code>for ($x = 0; $x &lt; 100; $x++) 
{
    echo "$x \r\n";
    sleep(1);
}
</code></pre>

<p>On a standard PHP configuration, this <em>should</em> produce an error 500 or some equivalent to tell the user that the script timed out.  I'd like to know if it's possible to make it so that PHP will still output the numbers 0 through some arbitrary X, X likely being the number of seconds that php.ini sets the timeout to be.</p>

<p>In doing research on this, I found this on Stack Overflow: <a href="http://stackoverflow.com/questions/2513110/is-there-a-way-to-make-php-progressively-output-as-the-script-executes">http://stackoverflow.com/questions/2513110/is-there-a-way-to-make-php-progressively-output-as-the-script-executes</a>.  Based on the solutions given in the thread, there are ways to achieve this on a case-by-case basis (i.e., you would have to specifically write each script so that it outputs correctly).</p>

<p>A comment mentioned in the above also mentions that you have set the <code>output_buffering</code> php.ini entry to zero in order for it to work, but you still then have to execute an <code>ob_flush()</code> and a <code>flush()</code> to actually output any data.</p>

<p>So, my question is: is it possible to configure PHP in such a way that a script will <em>always</em> be progressively sent to the browser?  For simplicity sake, we may want to assume that the web server will send the data to the browser immediately (instead of buffering data, and then sending it).  Thanks!</p>

<p><strong>Edit:</strong> to clarify, by <em>any</em> script I mean literally any PHP script on the server, and those scripts should not have to call any special functions in order for the progressive output to work.</p>
