question

RONALDORADUNZ-9541 avatar image
0 Votes"
RONALDORADUNZ-9541 asked RONALDORADUNZ-9541 commented

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 thoughts?
137848-code.png


azure-webapps
code.png (4.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

TakahitoIwasa avatar image
1 Vote"
TakahitoIwasa answered RONALDORADUNZ-9541 commented

Hi.

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.

https://dev.classmethod.jp/articles/app-service-on-linux-php-flush-buffering/

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

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you VERY much!
That is exactly the solution I was looking for.
The issue is related to PHP 8 because I just changed the PHP version to 7.4 and it worked perfectly!
I lost a week trying everthing but this...

0 Votes 0 ·