I have the following code inside a file (I’m running it directly via Terminal or I access the webpage, it makes no difference).
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', true);
ini_set('max_execution_time', 1);
ini_set('memory_limit', '512M');
sleep(2);
echo ini_get('max_execution_time');
And it outputs 1. Should it not throw an error, saying that the execution time was excedeed?
From phpinfo() I get:
max_execution_time 1 55
memory_limit 512M 1024M
sleep() time does not count toward execution time because it is not executing any code while it is sleeping.
This includes sleep(), as is mentioned several times in the comments for both sleep() and for set_time_limit(), e.g.