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.
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.
Only runs on *NIX systems, because Windows lacks of the needed pcntl ext.
| Ratings | Utility |
Consistency |
Documentation |
Examples |
Tests |
Videos |
Overall |
Rank |
| All time: |
Sufficient (65.6%) |
Sufficient (75.0%) |
Sufficient (68.8%) |
Sufficient (78.1%) |
- |
- |
Not sure (55.0%) |
1014 |
| Month: |
Not yet rated by the users |
| Class |
Dependency |
Why it is needed |
| DNServer |
Conditional |
To implement the DNServer_multithreaded. |
| PHP Cron Daemon |
Required |
This class forms the actual thread-generation. Is included by default |
| Link |
Description |
| PHPlet |
An application server written in PHP |

If you know an application of this package, send a message to the
author to add a link here.
| File |
Role |
Description |
action_dispatcher.php |
Example |
shows a multiprocess application scheme where all processes run a sleep() cycle, and a centralized dispatcher pass them the work. |
basic.php |
Example |
a basic example, only two pseudo-threads that increment a counter simultaneously |
exec_methods.php |
Example |
shows how to execute methods into the child process. |
Fork.php |
Class |
Main class |
INSTALL |
Doc. |
installation instructions |
passing_vars.php |
Example |
shows variable exchange between the parent process and started pseudo-threads. |
php_fork-api.html |
Doc. |
API docs |
simple_controller.php |
Example |
shows how to attach a controller to started pseudo-threads. |