I have a php script that gets called from a upload form, the script puts entries into a database. I would like to see the results on my browser as the script is running. I am using the code below, but the output shows up after the whole script has finished executing. My server is Apache2 running on Ubuntu. I thought by using ob_start(); I can see the progress while the script is executing. Am I doing something wrong in my code?
ob_start();
foreach ($csvAsArray as $value)
{
$username = $value[0];
$password = $value[1];
$db->insert($username, $password, $machine);
echo $username . " Inserted into database! <br />";
ob_flush();
}
echo('done.');
ob_end_flush();