note 80241 added to ref.exec
| From: | jakster at gmx dot net | Date: | Sat, 05 Jan 2008 12:56:27 +0000 |
| Subject: | note 80241 added to ref.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-134833@lists.php.net to get a copy of this message | ||
To fork a process I use the following code
<?php
fclose(STDOUT); //Close all output or it WON'T work
fclose(STDIN);
fclose(STDERR);
if(pcntl_fork()) {
exit; //Return to the caller
}
//Code to run in the background
pcntl_exec("/usr/bin/php",Array($_SERVER['argv'][1]));
?>
I call this script from my website with
<?php
function fork($script){ //run a forked php script relative to the document root. NO OUTPUT IS
DISPLAYED!
global $config;
$cmd = "/usr/bin/php \"" . dirname($_SERVER['SCRIPT_FILENAME']) .
"/includes/forked/forkHelper.php\" \"" . $script . "\"";
exec($cmd);
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 82.217.213.112
----
Manual Page -- http://www.php.net/manual/en/ref.exec.php
Edit -- https://master.php.net/note/edit/80241
Del: integrated -- https://master.php.net/note/delete/80241/integrated
Del: useless -- https://master.php.net/note/delete/80241/useless
Del: bad code -- https://master.php.net/note/delete/80241/bad+code
Del: spam -- https://master.php.net/note/delete/80241/spam
Del: non-english -- https://master.php.net/note/delete/80241/non-english
Del: in docs -- https://master.php.net/note/delete/80241/in+docs
Del: other reasons-- https://master.php.net/note/delete/80241
Reject -- https://master.php.net/note/reject/80241
Search -- https://master.php.net/manage/user-notes.php