2

I have this test code

<?php

if (ob_get_level() == 0) ob_start();

for ($i = 0; $i<10; $i++){

        echo "<br> Line to show.";
        echo str_pad('',4096)."\n";    

        ob_flush();
        flush();
        sleep(3);
}

echo "Done.";

ob_end_flush();

?>

It works fine when I tried to run it on MAMP local host (PHP 7.0.15, Apache web server) but when I tried it on the DreamHost server (PHP 7.0 CGI), the page loads for the total amount of sleep in the loop and output everything at the same time instead of having each line printed out between sleep intervals.

What should I do to fix this?

John
  • 41
  • 4

0 Answers0