Question

I'm running wampp server in Windows OS. Whenever pcntl_fork() is tried, a fatal error is shown as Fatal error: Call to undefined function pcntl_fork().

I found the PCNTL extension requires *nix platforms. If so is there is any alternatives of PCNTL for windows ?

Thanks much.

Was it helpful?

Solution

From what I've found there seems to be multiple solutions for forking in Windows. One of them is psexec with the following syntax:

exec('psexec -d php-cgi.exe somescript.php');

I've found this solution in this answer. Another option would be to use WScript.shell, found in this answer, with the following syntax:

$com = new Com('WScript.shell');
$com->run('php yourscript.php', 10, false);

For more documentation and information also check out the relevant MSDN page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top