I have code:
echo 'php_sapi_name: '.php_sapi_name().PHP_EOL;
echo 'max_input_time: '.ini_get('max_input_time').PHP_EOL;
echo 'max_execution_time: '.ini_get('max_execution_time').PHP_EOL;
set_time_limit(2);
echo 'max_input_time: '.ini_get('max_input_time').PHP_EOL;
echo 'max_execution_time: '.ini_get('max_execution_time').PHP_EOL;
sleep(3);
echo 'how it works?'.PHP_EOL;
And it's output
php_sapi_name: cli
max_input_time: -1
max_execution_time: 0
max_input_time: -1
max_execution_time: 2
how it works?
or
php_sapi_name: fpm-fcgimax_input_time: 60max_execution_time: 30max_input_time:
60max_execution_time: 2how it works?
I have no idea why this is happening. On Windows PHP 5.4.13 (cli)(built:
Mar 15 2013 02:07:14) it writes (Maximum execution time of 2 seconds
exceeded....)
Some info about my pc:
php -v:
PHP 5.6.7-1 (cli) (built: Mar 24 2015 12:30:15)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend
Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
uname -a:
Linux andrew-deb 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-2 (2015-04-13)
x86_64 GNU/Linux
php -i:
http://pastebin.com/vzeHZJn1
This is a bug or something I do not know about php?
sleep(3);
[...]
This is a bug or something I do not know about php?
Max execution time is working a bit dependent on the operating system.
On Windows it is using the elapsed time ("wall clock time") on Linux
systems the CPU time. Thus on windows the sleep counts whereas on Linux
no time is spent during sleep()
. The same difference happens when other
processes are on CPU and your PHP script was taken off CPU for other
reasons.
For details see MSDN on CreateTimerQueueTimer for Windows and the
setitimer man page with (ITIMER_PROF option) for Linux/Unix for a start.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682485%
28v=vs.85%29.aspx
http://linux.die.net/man/2/setitimer
johannes