How to make PHP flush() work on Azure web apps?

RONALDO RADUNZ 41 Reputation points

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 thoughts?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,347 questions
0 comments No comments
{count} votes

Accepted answer
  1. Takahito Iwasa 4,841 Reputation points MVP


    You're probably running on PHP8, so Nginx's default settings make this work.

    I tried changing the buffering mode and it worked, so I've posted the steps in the entry below.

    try it.
    Also, I think you should review the timeout value at the beginning from the viewpoint of the Nginx setting value.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful