0

I am trying to create a console for a script I'm working on, and make the progress stream in so the user can see it.

I read that having output_buffering disabled will not allow this to happen. So, I disabled it on my localhost server... I tried:

output_buffering = Off

output_buffering = 0

And commenting the line out although.

The console still works properly on localhost. Then I read that "gzip" won't allow this to happen. But gzip is enabled on both localhost and online server.

gzip compression enabled

zlib.output_compression is also Off

I even used diffchecker to change both the phpinfo(), and changed my localhost to be the exact same settings, yet it STILL works on localhost.

The only difference I can see is that my localhost is using CGI, and my server is using FastCGI.

Is this what's causing it not to work, and if not, what else would cause it to work on localhost, but not online?

Here's the basic code (it's being used with Ajax, but, I can't even make this basic version work):

<?php
ob_start();
echo "Starting...";
ob_flush();
flush();

echo "Finished with X";
ob_flush();
flush();
sleep(2);

echo "Finished with Y";
ob_flush();
flush();
sleep(2);

echo "Finished with Z";
ob_flush();
flush();
sleep(2);

?>
Joe
  • 143
  • 10
  • There are quite a few questions about this already, that have hints for different web servers / PHP embed variants, see if any of those contains something helpful. https://stackoverflow.com/questions/3133209/, https://stackoverflow.com/q/4481235/, https://stackoverflow.com/q/10579116/, https://stackoverflow.com/q/13751772/ – CBroe May 04 '22 at 06:53

1 Answers1

0

After spending forever reading threads, it seems that it was a problem with FastCGI and PHP. This code works though, even though I don't quite understand it.

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

        echo str_pad('',1024*64);    
        ob_flush();
        flush();
        usleep(500000);
Joe
  • 143
  • 10