Eventloops on Exeoutput causes a php crash

Pj1

New member
Connecting to evenloop made in exeoutput seems cause php to crash, is there some setting or a workaround to fix this..? 🤔
App just stays in "Just a moment, please..." and then crashes to "PHP Error: PHP Fatal error: Maximum execution time of 30 seconds exceeded.."

Weirdly enough, crash report points on line where that `sleep(1);` is

Same code runs fine on apache tho.


PHP:
@ini_set('output_buffering', 'off');
@ini_set('zlib.output_compression', 'off');
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
header('Connection: keep-alive');
while(true) {
    print "data: " . time() . PHP_EOL;
    print PHP_EOL;
    if (ob_get_level() > 0 && ob_get_length() > 0)
        @ob_end_flush();
  
    flush();
    sleep(1);
}
 
Back
Top