-
-
Save kocsismate/dbcc4ba81b27cfb2e25b949723bb7c79 to your computer and use it in GitHub Desktop.
Examples when https://wiki.php.net/rfc/max_execution_wall_time would be useful
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
sleep(3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set("max_execution_time", 10); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "http://localhost/index.php"); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 1); | |
for ($i = 0; $i < 100; $i++) { | |
curl_exec($ch); | |
echo curl_error($ch); | |
} | |
// This script will run for more than 100 seconds, even though max_execution_time is 10 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set("error_reporting", E_ALL); | |
ini_set("display_errors", 1); | |
ini_set("max_execution_time", 10); | |
ini_set("default_socket_timeout", 1); | |
for ($i = 0; $i < 100; $i++) { | |
echo "Iteration $i\n"; | |
file_get_contents("http://localhost/index.php"); | |
echo "\n----------------\n"; | |
} | |
// This script will run for more than 100 seconds, even though max_execution_time is 10 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment