So I am doing a bit of experimentation with PHP/Apache. Let us say I've this code.
<div>DIV 1</div> <?php sleep(2) ?> <div>DIV 2</div> <?php sleep(2) ?> <div>DIV 3</div> <?php sleep(2) ?> <div>DIV 4</div> <?php sleep(2) ?>
For whatever reason on my small local apache webserver all of the data seems within the browser at the same time, in the end 4 sleep()s happen to be performed (8 seconds).
If however I run it on my small host's server, the information is echo-erectile dysfunction towards the browser instantly. As with... div1 seems, after 2 seconds div 2 seems etc.
Can you explain that? Is some establishing Apache?
No it might be a establishing php.
In your soul local server, output_loading is enabled inside your php.ini file.
You are able to disable it by setting :
output_loading = off
To make sure that this content is distributed towards the browser every time a echo-like statement can be used, add :
implicit_flush = on
Additionally you can set the buffer size by providing output_loading something.
output_loading = 4096
here the buffer size could be 4KB.
Output loading informs php to help keep in memory all data to be delivered to the browser until it encouters a flush() instruction inside your code, the buffer is actually full, or it's the finish from the script.
This is actually the full reference for output buffer from php.internet : php output buffer