note 24753 rejected from function.popen by jmcastagnetto

From: Date: Tue, 27 Aug 2002 22:41:08 +0000
Subject: note 24753 rejected from function.popen by jmcastagnetto
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35816@lists.php.net to get a copy of this message
Can someone please HELP me out? I am trying to figure out a way to pipe in a file, in real-time, as it is being created by a background process. Currently it is waiting to read until my while is done before it even loads the page. I want to watch the file as it is being appended too. Any ideas? Current Code: shell_exec("nohup $cmdL >/dev/null 2>&1 &"); if (!file_exists($filename)) { touch($filename); // Create blank file chmod($filename,0666); } $fd = fopen($filename, "r"); while ($flag) { if( !feof ($fd) ) { $buffer = fgets($fd, 4096); echo(nl2br($buffer)); if( strstr($buffer, $str_error) || strstr($buffer, $str_done ) ) { $flag = 0; // Stop reading the file. } } } fclose($fd); Thanks, Joelle

« previous php.notes (#35816) next »