How could I mix popen() and pcntl_alarm() function ?

From: Date: Tue, 15 Jun 2010 17:07:34 +0000
Subject: How could I mix popen() and pcntl_alarm() function ?
Groups: php.general 
Request: Send a blank email to php-general+get-306172@lists.php.net to get a copy of this message
Hi, I want to use tail command to tail the file by popen and trigger the function signal() by every 3 secs. Here is my example code: declare(ticks = 1); // Unreachable function function signal($signal) { echo "SIGALRM\n"; pcntl_alarm(3); } pcntl_signal(SIGALRM, "signal"); pcntl_alarm(3); $fpcmd = popen("tail -f my.log", 'r'); while (!feof($fpcmd)) { $line = fgets($fpcmd); echo $line; } Unfortunately, the signal() function is never reached. Why ? Could someone help me ? Thanks for your help. - Arron

« previous php.general (#306172) next »