There are some situationĀ  when we run a time-consuming process, we need to see the output of that command to see its progress. Normally, we would have to wait until the process ends , then we can see the output. The reason for this is because web or standard output normally buffer some contents, it will wait for enough data to print out to the client. To fix this issue, we tell our server/script not buffering anything, print out immediately when it can. Here are some steps that i did in Python.

Step1: Tell the server not buffering anything, don’t use gzip ( if we use gzip, it will wait for the whole content) .

Add this to your .htaccess

Sometimes we also need to disable mod_deflate.

For our code, we need to flush the content to the client. Here is my code.

We can archive similar in PHP.