Ok, I know ths is possible, an example is here:
http://www.johnboy.com/php-upload-progress-bar/
It uses the ob_flush() and flush() functions of PHP. From what I've read, these functions have no effect if mod_gzip is enabled in your apache server. I'm on a shared hosting plan with Dreamhost and they have mod_gzip enabled, but you can request to have it turned off for certain subdomains. I did so, but it seems that it didn't have an effect. Here is my code:
This should output numbers from 0 to 5 over 5 seconds, sequentially, WHILE the page is loading. Instead it just takes 5 seconds for the page to load and then outputs the whole thing at once.
I need to know how to make this work. I have a script that can take 30-45 seconds to run and I want something for my users to look at. Using Flash really isn't an option because I don't know flash. I COULD use AJAX and simply send a request to another script, but I'd like to try to avoid anything that requires Javascript.
Please, if you guys could help me out, I'd be super grateful!
http://www.johnboy.com/php-upload-progress-bar/
It uses the ob_flush() and flush() functions of PHP. From what I've read, these functions have no effect if mod_gzip is enabled in your apache server. I'm on a shared hosting plan with Dreamhost and they have mod_gzip enabled, but you can request to have it turned off for certain subdomains. I did so, but it seems that it didn't have an effect. Here is my code:
Code:
<?php ob_start(); for ($i = 0; $i < 5; $i++) { echo $i . "<br>"; ob_end_flush(); ob_flush(); flush(); sleep(1); ob_start(); } ob_end_flush(); ?>
I need to know how to make this work. I have a script that can take 30-45 seconds to run and I want something for my users to look at. Using Flash really isn't an option because I don't know flash. I COULD use AJAX and simply send a request to another script, but I'd like to try to avoid anything that requires Javascript.
Please, if you guys could help me out, I'd be super grateful!
Comment