<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/refs.fileprocess.process.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'book.pcntl.php',
    1 => 'PCNTL',
    2 => 'Process Control',
  ),
  'up' => 
  array (
    0 => 'refs.fileprocess.process.php',
    1 => 'Process Control Extensions',
  ),
  'prev' => 
  array (
    0 => 'function.expect-popen.php',
    1 => 'expect_popen',
  ),
  'next' => 
  array (
    0 => 'pcntl.setup.php',
    1 => 'Installing/Configuring',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pcntl/book.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/book.pcntl.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="book.pcntl" class="book">
 
 <h1 class="title">Process Control</h1>
 
 
 
 <div id="intro.pcntl" class="preface">
  <h1 class="title">Introduction</h1>
  <p class="para">
   Process Control support in PHP implements the Unix style of
   process creation, program execution, signal handling and process
   termination. Process Control should not be enabled within a
   web server environment and unexpected results may happen if any
   Process Control functions are used within a web server environment.
  </p>
  <p class="para">
   This documentation is intended to explain the general usage of
   each of the Process Control functions. For detailed information
   about Unix process control you are encouraged to consult your
   systems documentation including fork(2), waitpid(2) and signal(2)
   or a comprehensive reference such as Advanced Programming in the
   UNIX Environment by W. Richard Stevens (Addison-Wesley).
  </p>
  <p class="para">
   PCNTL now uses ticks as the signal handle callback mechanism, which is
   much faster than the previous mechanism. This change follows the same
   semantics as using &quot;user ticks&quot;. You use the <span class="function"><strong>declare()</strong></span> 
   statement to specify the locations in your program where callbacks are
   allowed to occur. This allows you to minimize the overhead of handling
   asynchronous events. In the past, compiling PHP with pcntl enabled would
   always incur this overhead, whether or not your script actually used
   pcntl.
  </p>

  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">This extension is not
available on Windows platforms.</span></p></blockquote>
 </div>
 

 







 




 







 




 








<ul class="chunklist chunklist_book"><li><a href="pcntl.setup.php">Installing/Configuring</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="pcntl.installation.php">Installation</a></li></ul></li><li><a href="pcntl.constants.php">Predefined Constants</a></li><li><a href="pcntl.examples.php">Examples</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="pcntl.example.php">Basic usage</a></li></ul></li><li><a href="enum.pcntl-qosclass.php">Pcntl\QosClass</a> — The Pcntl\QosClass Enum</li><li><a href="ref.pcntl.php">PCNTL Functions</a><ul class="chunklist chunklist_book chunklist_children"><li><a href="function.pcntl-alarm.php">pcntl_alarm</a> — Set an alarm clock for delivery of a signal</li><li><a href="function.pcntl-async-signals.php">pcntl_async_signals</a> — Enable/disable asynchronous signal handling or return the old setting</li><li><a href="function.pcntl-errno.php">pcntl_errno</a> — Alias of pcntl_get_last_error</li><li><a href="function.pcntl-exec.php">pcntl_exec</a> — Executes specified program in current process space</li><li><a href="function.pcntl-fork.php">pcntl_fork</a> — Forks the currently running process</li><li><a href="function.pcntl-get-last-error.php">pcntl_get_last_error</a> — Retrieve the error number set by the last pcntl function which failed</li><li><a href="function.pcntl-getcpuaffinity.php">pcntl_getcpuaffinity</a> — Get the cpu affinity of a process</li><li><a href="function.pcntl-getpriority.php">pcntl_getpriority</a> — Get the priority of any process</li><li><a href="function.pcntl-getqos-class.php">pcntl_getqos_class</a> — Get the QoS class of the current thread</li><li><a href="function.pcntl-rfork.php">pcntl_rfork</a> — Manipulates process resources</li><li><a href="function.pcntl-setcpuaffinity.php">pcntl_setcpuaffinity</a> — Set the cpu affinity of a process</li><li><a href="function.pcntl-setpriority.php">pcntl_setpriority</a> — Change the priority of any process</li><li><a href="function.pcntl-setqos-class.php">pcntl_setqos_class</a> — Set the QoS class of the current thread</li><li><a href="function.pcntl-signal.php">pcntl_signal</a> — Installs a signal handler</li><li><a href="function.pcntl-signal-dispatch.php">pcntl_signal_dispatch</a> — Calls signal handlers for pending signals</li><li><a href="function.pcntl-signal-get-handler.php">pcntl_signal_get_handler</a> — Get the current handler for specified signal</li><li><a href="function.pcntl-sigprocmask.php">pcntl_sigprocmask</a> — Sets and retrieves blocked signals</li><li><a href="function.pcntl-sigtimedwait.php">pcntl_sigtimedwait</a> — Waits for signals, with a timeout</li><li><a href="function.pcntl-sigwaitinfo.php">pcntl_sigwaitinfo</a> — Waits for signals</li><li><a href="function.pcntl-strerror.php">pcntl_strerror</a> — Retrieve the system error message associated with the given errno</li><li><a href="function.pcntl-unshare.php">pcntl_unshare</a> — Dissociates parts of the process execution context</li><li><a href="function.pcntl-wait.php">pcntl_wait</a> — Waits on or returns the status of a forked child</li><li><a href="function.pcntl-waitid.php">pcntl_waitid</a> — Waits for a child process to change state</li><li><a href="function.pcntl-waitpid.php">pcntl_waitpid</a> — Waits on or returns the status of a forked child</li><li><a href="function.pcntl-wexitstatus.php">pcntl_wexitstatus</a> — Returns the return code of a terminated child</li><li><a href="function.pcntl-wifexited.php">pcntl_wifexited</a> — Checks if status code represents a normal exit</li><li><a href="function.pcntl-wifsignaled.php">pcntl_wifsignaled</a> — Checks whether the status code represents a termination due to a signal</li><li><a href="function.pcntl-wifstopped.php">pcntl_wifstopped</a> — Checks whether the child process is currently stopped</li><li><a href="function.pcntl-wstopsig.php">pcntl_wstopsig</a> — Returns the signal which caused the child to stop</li><li><a href="function.pcntl-wtermsig.php">pcntl_wtermsig</a> — Returns the signal which caused the child to terminate</li></ul></li></ul></div><?php manual_footer($setup); ?>