Last active
August 29, 2015 14:23
-
-
Save mithereal/ba5153c7453abd6916a7 to your computer and use it in GitHub Desktop.
detect php max timeout limit on shared hosting
This file contains hidden or 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 | |
$max_timeout = 600; | |
$start = time(); | |
register_shutdown_function('shutdown',$start); | |
for(;;) | |
{ | |
$finish = time(); | |
$total = $finish - $start; | |
if($total >= $max_timeout) | |
{ | |
exit; | |
} | |
} | |
function shutdown($start) | |
{ | |
$finish = time(); | |
$total = $finish - $start; | |
// Store $total in DB | |
echo json_encode($total); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment