Php real-time output in IIS7 is invalid in phpflush

Source: Internet
Author: User
This article mainly introduces the php flush ineffective method and the php real-time output method in IIS7. if you need it, refer to this article to introduce the php flush ineffective method and the php real-time output method in IIS7, for more information, see

In a relatively time-consuming operation, if you want to display the operation records in the browser in real time, use flush () to send the contents in the buffer to the browser. However, in iis7, php configured in fastcgi mode cannot be implemented, and the results are always displayed together.

for ($i=10; $i>0; $i--){  echo $i.'
'; @ob_flush(); flush(); sleep(1);}

The above code cannot gradually display the results under the default settings of IIS. The solution is as follows:

Open the file C: \ Windows \ System32 \ inetsrv \ config \ applicationHost. config. Note that if you use a 64-bit system, the file must be opened with a 64-bit editing software. if you open a 32-bit software, the system will prompt that the file does not exist, use the notepad that comes with the system to open it. Find the following section and add the red section of code, that is, add responseBufferLimit = "0" to the handler of php ".

The code is as follows:

 

Now, you can try output_buffering = Off in php. ini.

Finally, it is very important to use different results in different browsers. There should be no problem in IE. if chrome is used, the content of each echo must contain html, otherwise it will not work, in addition, if the echo content is too short to achieve this effect, you can output a space before the code, such as echo str_pad ('', 1050 ); chrome seems to have to output more than 1000 characters for this effect. if not, try more.

The above is the detailed description of php real-time output methods under php flush 7 is invalid. For more information, see other related articles in the first PHP community!

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.