I have two questions concerning the sleep()
function in PHP:
Does the sleep time affect the maximum execution time limit of my PHP scripts? Sometimes, PHP shows the message "maximum execution time of 30 seconds exceeded". Will this message appear if I use sleep(31)
?
Are there any risks when using the sleep()
function? Does it cost a lot of CPU performance?
You should try it, just have a script that sleeps for more than your maximum execution time.
<?php
sleep(ini_get('max_execution_time') + 10);
?>
Spoiler: Under Linux, sleeping time is ignored, but under Windows, it counts as execution time.