PHP script timeout when I use sleep()

839 views Asked by At

I have problem with php script timeout when I use sleep()

this code:

<?php      
ob_start();
header('Content-Type: text/html; charset=utf-8');
echo 'Begin ...<br />';
flush();
ob_flush();
for ($i = 0; $i < 10; $i++) {
    echo $i . '<br />';
    flush();
    ob_flush();
    sleep(65);
}
echo 'End ...<br />';
flush();
ob_flush();
?>

When I execute this code and wait 60 seconds script has stop working.

This server config

php.ini

max_execution_time 3600;

nginx.conf

keepalive_timeout 3600;

How do I config for solve this problem?

Excuse me, I'm not good english.

1

There are 1 answers

0
Seva Kobylin On

Show your nginx configs.

You need increase proxy_read_timeout in nginx configuration.