Ouput stuff while php script is running


So I just created a script to resize a whole bunch of images. Is there anyway to have there be output as its running through the loop?

Basically I have like 400 photos in photo db table. Its gathering a list of all these photos, then looping through each one and resizing it 3 times. (large,medium,small version).

Right now on each loop I am echoing that images results, but I dont see the results untill EVERYTHING is done. So like 10 minutes later, I will get output. I added this set_time_limit(0); to make sure it doesnt time out.

**EDIT ** It looks like every so often the script actually updates to the browser, maybe every 30 seconds?




You can useflush() orob_flush() to tell the script to send something back to the client after you do anecho().

BUT - you never really have complete control over it, the web server does, so the web server may not cooperate depending on how its configured. For example, if you have the server doing gzip rather than using PHP's gzip features, the web server may still buffer the output.

People are also looking for solutions to the problem: php - Zend Test assertResponseCode incompatible with PHPUnit?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.