note 70708 added to function.pcntl-exec
| From: | erickilfoil at osu1 dot php dot net | Date: | Tue, 24 Oct 2006 17:01:12 +0000 |
| Subject: | note 70708 added to function.pcntl-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119079@lists.php.net to get a copy of this message | ||
The pcntl_exec() function works exactly like the standard (unix-style) exec() function. It differs
from the regular PHP exec() function in that the process calling the pcntl_exec() is replaced with
the process that gets called. This is the ideal method for creating children. In a simple example
(that does no error checking):
switch (pcntl_fork()) {
case 0:
$cmd = "/path/to/command";
$args = array("arg1", "arg2");
pcntl_exec($cmd, $args);
// the child will only reach this point on exec failure,
// because execution shifts to the pcntl_exec()ed command
exit(0);
default:
break;
}
// parent continues
echo "I am the parent";
--
since this is not being executed through a shell, you must provide the exact path from the
filesystem root. Look at the execve() man page for more information.
----
Server IP: 64.71.164.2
Probable Submitter: 62.189.45.132 (proxied: 1.0 EU-UKEP-ISA01)
----
Manual Page -- http://www.php.net/manual/en/function.pcntl-exec.php
Edit -- https://master.php.net/note/edit/70708
Del: integrated -- https://master.php.net/note/delete/70708/integrated
Del: useless -- https://master.php.net/note/delete/70708/useless
Del: bad code -- https://master.php.net/note/delete/70708/bad+code
Del: spam -- https://master.php.net/note/delete/70708/spam
Del: non-english -- https://master.php.net/note/delete/70708/non-english
Del: in docs -- https://master.php.net/note/delete/70708/in+docs
Del: other reasons-- https://master.php.net/note/delete/70708
Reject -- https://master.php.net/note/reject/70708
Search -- https://master.php.net/manage/user-notes.php