note 18840 added to function.system

From: Date: Thu, 07 Feb 2002 03:47:03 +0000
Subject: note 18840 added to function.system
Groups: php.notes 
Request: Send a blank email to php-notes+get-26328@lists.php.net to get a copy of this message
Here's a neat trick that exploits an inherent php anomaly... if you want to run a shell command but not have it take up two processes for the entire life of the command (a child for the shell and a grandchild for the command), add a "&" at the end of the command to kill the shell and leave the grandchild command running... Though it's a bit counterintuitive, php will continue to listen for the orphanized grandchild command's STDOUT as long as it continues to run, provided STDOUT hasn't been been redirected with a ">/some/file"... Very helpful if you're in a low-process-quota situation - I might even go so far as to say that this benefit might warrant ALWAYS using a "&" in php Unix system command situations - though the jury's still out on that one... -- http://www.php.net/manual/en/function.system.php http://master.php.net/manage/user-notes.php?action=edit+18840 http://master.php.net/manage/user-notes.php?action=delete+18840 http://master.php.net/manage/user-notes.php?action=reject+18840

« previous php.notes (#26328) next »