note 116674 added to function.pcntl-fork

From: Date: Mon, 09 Feb 2015 03:39:58 +0000
Subject: note 116674 added to function.pcntl-fork
Groups: php.notes 
Request: Send a blank email to php-notes+get-201671@lists.php.net to get a copy of this message
Workaround to pcntl_fork() not being usable when PHP is run as an Apache module function background_job($program, $args) { # The following doesn't work when running PHP as an apache module /* $pid = pcntl_fork(); pcntl_signal(SIGCHLD, SIG_IGN); if ($pid == 0) { posix_setsid(); pcntl_exec($program, $args, $_ENV); exit(0); } */ # Workaround $args = join(' ', array_map('escapeshellarg', $args)); exec("$program $args 2>/dev/null >&- /dev/null &"); } ---- Server IP: 72.52.91.14 Probable Submitter: 121.223.232.23 ---- Manual Page -- http://php.net/manual/en/function.pcntl-fork.php Edit -- https://master.php.net/note/edit/116674 Del: integrated -- https://master.php.net/note/delete/116674/integrated Del: useless -- https://master.php.net/note/delete/116674/useless Del: bad code -- https://master.php.net/note/delete/116674/bad+code Del: spam -- https://master.php.net/note/delete/116674/spam Del: non-english -- https://master.php.net/note/delete/116674/non-english Del: in docs -- https://master.php.net/note/delete/116674/in+docs Del: other reasons-- https://master.php.net/note/delete/116674 Reject -- https://master.php.net/note/reject/116674 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201671) next »