Why does the PHP flash not always work, the page is not loaded 1/5 times properly?

The large php script uses flush to send part of the generated html to the browser, while it runs most of the script, which takes approx. 20 seconds

The part of the script that runs after the flush is quite large and takes up a lot of space from server reserves (90% processor).

Once 5 times, the page remains blanc (white), which means that the flash has not arrived to send an image showing the loading of the page. The page remains blanc (the browser indicates that it is still loading) also when the program is finished, and it should send the entire page to the browser.

Wonderful: When I click the back button, the whole page will be displayed (which should have been loaded in the browser after the entire script was executed), and then the browser returns to the previous page.

All other 4 times the page loads well. The input for php script is the same for all 5 times.

I have these settings in my .htacces file:

addhandler x-httpd-php5-cgi .php5 
addhandler x-httpd-php5-cgi .php5
addhandler x-httpd-php5-cgi .php5 
Header Set Cache-Control "max-age=0, no-store"

This is the instruction to reset the generated code to the browser:

print str_pad('',4096)."\n";
ob_flush();
flush();

What could be causing this problem?

+5
source share
2 answers

: flush() apache/webserver, /, , /, , /. , . Gearman , , .

+2
print str_pad('',4096)."\n";

, ? ,

print str_pad(' ',4096)."\n";

, - , , , , .

+2

All Articles