test.php
<?php
sleep(45);
phpinfo();
upon executing above code, after 47 sec, i'm getting response :
max_execution_time 30 | 30
strange but yes phpinfo()
showing invalid timeout value.
upon sleep(75);phpinfo();
after 61 sec I'm getting request timout error in browser.
Problem: Not sure why phpinfo()
is showing invalid value?
PHP Version: 5.6.29
Server API: FPM/FastCGI
php-fpm: active
NGINX_VERSION: 1.11.8; linux
from above tests, it seems, server max_execution_time is 60 sec but its showing 30sec in phpinfo();
No, this is entirely expected. sleep() is blocking call. PHP doesn't know it has timed out until the execution thread is scheduled by the OS.
Try:
for ($x=0; $x<30; $x++) sleep(2);
<?php
set_time_limit(300)
sleep(45);
phpinfo();
set new max_execution_time with set_time_limit() function