How to install PCNTL extension in Windows?

Yogesh picture Yogesh · May 5, 2015 · Viewed 39.3k times · Source

I am running PHPUnit in Windows and trying to install PHPUnit via composer.json:

"phpunit/php-invoker": "*"

...with this dependency, but I am getting this error:

phpunit/php-invoker 1.1.3 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.

How can I install this extenstion?

Answer

Aleksander Wons picture Aleksander Wons · May 6, 2015

You can't install ext-pcntl extension on Windows. Accordingly to the PHP documentation:

Currently, this module will not function on non-Unix platforms (Windows).

If you want to install PHPUnit all you need is the PHPUnit library:

composer require phpunit/phpunit 4.*

You don't need php-invoker to install PUPUnit. But if you also need the php-invoker library you are out of luck. Try using Vagrant or a plain VM with Linux distributions like Ubuntu, Debian or Mint.