PHP code example of ssigwart / process-pool

1. Go to this page and download the library: Download ssigwart/process-pool library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ssigwart / process-pool example snippets


$minPoolSize = 1;
$maxPoolSize = 10;
poolProcessCmd = 'php process.php';
$cwd = '/path/to/pool/process';
$pool = new ProcessPool($minPoolSize, $maxPoolSize, $poolProcessCmd, $cwd);
$pool->setMaxNumSpareProcesses(3);

$req1 = $pool->startProcess();
$req1->sendRequest('Your message');
$req1->getStdoutResponse();
$req1->getStderrResponse();
$pool->releaseProcess($req1);