Home » PHP » PHP_Fork
PHP_Fork class. Wrapper around the pcntl_fork() stuff with a API set like Java language
This package is unmaintained.
Download latest release 0.4.0 (archived versions might be outdated)
License: PHP License
Description
PHP_Fork class. Wrapper around the pcntl_fork() stuff
with a API set like Java language.
Practical usage is done by extending this class, and re-defining
the run() method.
[see basic example]
This way PHP developers can enclose logic into a class that extends
PHP_Fork, then execute the start() method that forks a child process.
Communications with the forked process is ensured by using a Shared Memory
Segment; by using a user-defined signal and this shared memory developers
can access to child process methods that returns a serializable variable.
The shared variable space can be accessed with the tho methods:
o void setVariable($name, $value)
o mixed getVariable($name)
$name must be a valid PHP variable name;
$value must be a variable or a serializable object.
Resources (db connections, streams, etc.) cannot be serialized and so they're not correctly handled.
Requires PHP build with --enable-cli --with-pcntl --enable-shmop.
Only runs on *NIX systems, because Windows lacks of the pcntl ext.
@example browser_pool.php an interactive tool to perform multiple cuncurrent request over an URL.
@example simple_controller.php shows how to attach a controller to started pseudo-threads.
@example exec_methods.php shows a workaround to execute methods into the child process.
@example passing_vars.php shows variable exchange between the parent process and started pseudo-threads.
@example basic.php a basic example, only two pseudo-threads that increment a counter simultaneously.
Maintainers
- Luca Mariano (lucamariano) — lead, inactive
Dependencies
Required
- PHP (>= 5.0.0)
- PEAR Installer (>= 1.4.0b1)
- pcntl (extension)
- shmop (extension)
- posix (extension)
Releases
- 0.4.0 (beta, 2017-08-07)
Release notes
License: PHP License
Bumped PHP minimum to 5.0.0
PR #3 Renamed constructors to __construct - 0.3.2 (beta, 2010-10-25)
Release notes
License: PHP License
Automatically built QA release
Bug #9472 package not installable - cweiske - 0.3.1 (beta, 2008-10-26)
- 0.3.0 (beta, 2005-03-24)
Release notes
License: PHP License
* Added isActive() facilty to check if the process is into its run() method.
* Added IPC segments cleanup after the stop() method is called
(this totally free up detached shared memory as revealed by the ipcs command).
* Added a complex usage example (examples/browser_pool.php).
* Some minor changes into example scripts to accomplish php5 syntax rules. - 0.2.0 (beta, 2005-01-04)
- 0.1 (beta, 2004-03-18)
Bugs
| ID | Status | Type | Version | Date | Summary |
|---|---|---|---|---|---|
| #2758 | Closed | Bug | 2004-11-15 | Deps not listed | |
| #5186 | Open | Bug | 2005-08-23 | IPC Share memory segments stay resident | |
| #9472 | Closed | Bug | 0.3.0 | 2006-11-26 | package not installable |
| #12210 | Duplicate | Bug | 0.3.0 | 2007-10-09 | Channel not available |