vendredi 1 octobre 2021

how to make php flush() work on azure web apps?

This simple script will run without a problem on a LAMP server (Ubuntu) running on a VM/Azure. However, when ported to Azure web apps (php), the same script will get a 502 or 504 error after 5 minutes, and will show no output. If the number of lines is reduced to less than 300 (about 5 minutes time) it will run, but all lines will appear only when the script ends. Any thougths?

ini_set('max_execution_time', 0);
for($i=0;$i<600;$i++)
{
    echo 'printing...'.$i."<br>";
    ob_flush();
    flush();
    sleep(1);
}



Aucun commentaire:

Enregistrer un commentaire