PHP Flush Invalid IIS7 The method of PHP real-time output

Source: Internet
Author: User
This article mainly introduces the PHP flush invalid, IIS7 PHP real-time output method, the need for friends can refer to the next

In a more time-consuming operation, I want to display the operation record in realtime on the browser and use Flush () to send the contents of the buffer to the browser. But in the IIS7 in the fastcgi mode configuration of PHP can not be implemented, the results are always displayed together.

for ($i =10; $i >0; $i-) {  echo $i. ' <br/> ';  @ob_flush ();  Flush ();  Sleep (1);}

The above code is not able to gradually display the results under IIS default settings. The solution is as follows:

Open file C:\Windows\System32\inetsrv\config\applicationHost.config, note If you are a 64-bit system, this file must be opened with 64-bit editing software, 32-bit software open will prompt the file does not exist , you can use the system's own Notepad notepad to open it. Find the following paragraph, add the red code on the line, that is, PHP this handler inside add responsebufferlimit= "0".

The code is as follows:


Now you can try it, if it doesn't work, put php.ini inside the output_buffering = Off.

The last point of the

is important, and there are different results in the browser. IE inside should be no problem, if it is with chrome, each echo out of the content must have HTML, otherwise it is not, and if the echo content is too short to achieve this effect, you can first output a space before the code, such as: Echo Str_pad (", 1050); Chrome seems to have to output more than 1000 characters to have this effect, no words to try.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.