WAMP and pcntl_fork

Is there a way to get pcntl_fork to work in WAMP? I need to develop a branching solution and test it locally.

+6
php wamp
source share
3 answers

No, It is Immpossible. The PCNTL extension requires * nix platforms.

Now, with that said, what are you trying to do, and can you solve it without overlay ...?

Edit: Some alternatives to running background processes:

+10
source share

pseudo-code solution:

 while (TRUE) { $process_limit = get_process_limit(); $process_count = get_process_count(); if process count < process limit: { // get_row returns a row (as an array) from the DB that needs to be processed $row = get_row(); if($row === array()) { // Nothing to process; sleep sleep(2); } else { // Process row process_count(+1); process_row($row); process_count(-1); } } elseif process count === process limit { // Do not add to the process exit; } elseif process count > process limit { // Means the process limit was decreased // Terminate this process instance process_count(-1); exit; } } 
-one
source share

This has already been answered, but I thought I would add 2p.

You can have pcntl-fork with php on windows using cygwin.

This is a real pain to install, but if I like it, you just want to run php cli script, this is your best choice.

I got instructions from here :

-one
source share

All Articles