Search code examples
phpapacheoutput-buffering

Stop PHP output buffering


I need to display continuous output from my php script. The script will stay in a loop of printing log data from a device and sleeping. My problem is that I can't get PHP or Apache to output data before the script is completed.

I have tried all the commands for flushing the output buffer, and I have read through the config-files for both PHP and Apache looking for some type of buffering to disable.

Is this possible to do with Apache and PHP on Windows, or should I consider some other platform?


Solution

  • The best way (most reliable and clean) to accomplish this is to use a server-side script which does the work, and a client-side AJAX script which will poll another server-side script which will return the status. In the web, data is buffered at different levels, to achieve optimization, and therefore it is difficult to accomplish what you want.