note 105569 modified in function.set-time-limit by danbrown

From: Date: Mon, 29 Aug 2011 12:46:42 +0000
Subject: note 105569 modified in function.set-time-limit by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182803@lists.php.net to get a copy of this message
A nice workaround to have a real max_execution_time (needs posix and pcntl): <?php $pid=pcntl_fork(); if ($pid) { //long time process $a=0; while (true) { echo "a=$a\n\n"; ob_flush(); flush(); $a++; shell_exec('sleep 10&'); } } else { //time-limit checker sleep(5); posix_kill(posix_getppid(),SIGKILL); } ?> --was-- A nice workaround to have a real max_execution_time (needs posix and pcntl): $pid=pcntl_fork(); if ($pid) { //long time process $a=0; while (true) { echo "a=$a\n\n"; ob_flush(); flush(); $a++; shell_exec('sleep 10&'); } } else { //time-limit checker sleep(5); posix_kill(posix_getppid(),SIGKILL); } http://php.net/manual/en/function.set-time-limit.php

« previous php.notes (#182803) next »