Process Control
Introduction
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.
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).
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 "user ticks". You use the declare() 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.
Note: This extension is not available on Windows platforms.
- Installing/Configuring
- Predefined Constants
- Examples
- Pcntl\QosClass — The Pcntl\QosClass Enum
- PCNTL Functions
- pcntl_alarm — Set an alarm clock for delivery of a signal
- pcntl_async_signals — Enable/disable asynchronous signal handling or return the old setting
- pcntl_errno — Alias of pcntl_get_last_error
- pcntl_exec — Executes specified program in current process space
- pcntl_fork — Forks the currently running process
- pcntl_get_last_error — Retrieve the error number set by the last pcntl function which failed
- pcntl_getcpuaffinity — Get the cpu affinity of a process
- pcntl_getpriority — Get the priority of any process
- pcntl_rfork — Manipulates process resources
- pcntl_setcpuaffinity — Set the cpu affinity of a process
- pcntl_setpriority — Change the priority of any process
- pcntl_signal — Installs a signal handler
- pcntl_signal_dispatch — Calls signal handlers for pending signals
- pcntl_signal_get_handler — Get the current handler for specified signal
- pcntl_sigprocmask — Sets and retrieves blocked signals
- pcntl_sigtimedwait — Waits for signals, with a timeout
- pcntl_sigwaitinfo — Waits for signals
- pcntl_strerror — Retrieve the system error message associated with the given errno
- pcntl_unshare — Dissociates parts of the process execution context
- pcntl_wait — Waits on or returns the status of a forked child
- pcntl_waitid — Waits for a child process to change state
- pcntl_waitpid — Waits on or returns the status of a forked child
- pcntl_wexitstatus — Returns the return code of a terminated child
- pcntl_wifexited — Checks if status code represents a normal exit
- pcntl_wifsignaled — Checks whether the status code represents a termination due to a signal
- pcntl_wifstopped — Checks whether the child process is currently stopped
- pcntl_wstopsig — Returns the signal which caused the child to stop
- pcntl_wtermsig — Returns the signal which caused the child to terminate