How to show your script output as it is producing it. Normally everything is buffered and shown all at once, but sometimes you want to show the actual progress of the script.
This needs a few steps to get it working.
The basic code:
ini_set('max_execution_time', 3600);
set_time_limit(3600);
ini_set('implicit_flush', 1);
ob_implicit_flush(1);
for ($i = 0; $i < ob_get_level(); $i++) {
ob_end_flush();
}
ob_implicit_flush(1);
function my_flush()
{
echo str_repeat(' ', 4096);
if (ob_get_length()>0) {
ob_flush();
flush();
}
}
echo 'show this now!<br/>';
my_flush();
sleep(5);
echo 'show this later!<br/>';
my_flush();
That should do it.
However, if you are trying this on your Synology Web Station, you also need to continue with these steps.
Have a nice day!