Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
801 views
in Technique[技术] by (71.8m points)

iis 7.5 - PHP flush stopped flushing in IIS7.5

We have been using php flush to "blank" a page immediately as soon as it is clicked, and also to send the navigation and main components of the page so that a page appears nearly instantly, even though sometimes the content may take a long time to load.

This has been working very well.

Recently we upgraded from IIS 7.0 to 7.5 and now flush does not work. While investigating the problem we have turned off compression for both static and dynamic files. We have also turned off output caching.

We also have zlib compression turned off and output buffering off in php.ini.

In order to test the problem we have the following script

@ini_set("output_buffering", "Off");
@ini_set('implicit_flush', 1);
@ini_set('zlib.output_compression', 0);

ob_start();

echo "starting...<br/>
";
for($i = 0; $i < 5; $i++) {
    print "$i<br/>
";
    ob_end_flush(); 
    ob_flush();
    flush();
    ob_start();
    sleep(2);
}
print "DONE!<br/>
";

The browser just shows the loading status (whatever that is in any browser, in IE it looks like an Ajax animated gif, in Firefox the tab will say "Connecting...") for 10 seconds, and then suddenly the entire output appears.

We have tried various combinations of flush and ob_flush and ob_end_flush based upon similar questions on this site. None of them work. Is there any way to make IIS/PHP flush the data?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is another way to set the Response Limit using the IIS Manager:

  1. On the server main page, under "Management", select "Configuration Editor";
  2. under "Section", enter 'system.webServer/handlers';
  3. next to "(Collection)" click "..." OR mark the element "(Collection)" and, under "Actions" und '(Collection)' Element, click "Edit Items";
  4. scroll down until you find your PHP version under "Name";
  5. at the bottom, the Properties are shown an can be edited manually, including responseBufferLimit, which should be set to 0 for flush() to work.

The big Pro is that you can edit the properties for everything, not only PHP plus you can work with different versions (or even installations of the same version) of PHP.

HTH


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...