note 125932 added to function.set-time-limit
| From: | Daan@php.net | Date: | Mon, 15 Mar 2021 12:00:56 +0000 |
| Subject: | note 125932 added to function.set-time-limit | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219128@lists.php.net to get a copy of this message | ||
If you would like to calculatue the wall time of your script (includes all external DB/HTTP calls
etc.) in Unix (in Windows this is already default behavior), you could use the following function:
<?php
$timeoutInSeconds = 3;
// This will make sure this is always called async
pcntl_async_signals(1);
// Second parameter is any callable (https://www.php.net/manual/en/language.types.callable.php)
pcntl_signal(SIGALRM, function() {
exit('Stop it!');
});
pcntl_alarm($timeoutInSeconds);
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.246 (proxied: 2001:16b8:46de:b200:6485:7570:16a1:dfd3)
----
Manual Page -- http://php.net/manual/en/function.set-time-limit.php
Edit -- https://master.php.net/note/edit/125932
Del: integrated -- https://master.php.net/note/delete/125932/integrated
Del: useless -- https://master.php.net/note/delete/125932/useless
Del: bad code -- https://master.php.net/note/delete/125932/bad+code
Del: spam -- https://master.php.net/note/delete/125932/spam
Del: non-english -- https://master.php.net/note/delete/125932/non-english
Del: in docs -- https://master.php.net/note/delete/125932/in+docs
Del: other reasons-- https://master.php.net/note/delete/125932
Reject -- https://master.php.net/note/reject/125932
Search -- https://master.php.net/manage/user-notes.php