note 18840 deleted from function.system by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 09:00:14 +0000 |
| Subject: | note 18840 deleted from function.system by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196811@lists.php.net to get a copy of this message | ||
Note Submitter: nospam at 1111-internet dot com
----
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...