I have this PHP script below that, for some reason, doesn't allow me to output to the browser as the script is running. This is a heavy script and will likely run for 10-15 minutes in a production environment, so I would need to be able to see the output as it is progressing rather than just a massive output right at the end.
set_time_limit(0);
ini_set("memory_limit", "256M");
apache_setenv('no-gzip', 1);
ini_set('zlib.output_compression', 0);
ini_set('implicit_flush', 1);
ob_end_flush();
ob_flush();
flush();
ob_start();
echo "Script STARTED at " . date("Y-m-d H:i:s", time()) . "<br />";
// get all the "payments"
$result = mysql_query("SELECT * FROM payments");
while ($payment = mysql_fetch_array($result)) {
// do a SQL update in here
echo "Write out progress here...<br />";
}
echo "Script ENDED at " . date("Y-m-d H:i:s", time()) . "<br />";
An httpd -v
gives me:
Server version: Apache/2.2.3 Server built: Oct 20 2011 17:00:12
and I am running PHP 5.3.27
I've taken some code in this script from other SO posts, but this current setup does not work.