How can I install the PCNTL extension on Windows?
Asked Answered
M

4

25

I am running PHPUnit in Windows and am 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 extension?

Magnific answered 5/5, 2015 at 5:41 Comment(0)
C
20

You can't install the ext-pcntl extension on Windows. According 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 PHPUnit. 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 Linux Mint.

Charlean answered 6/5, 2015 at 18:51 Comment(0)
Y
8

If you're running on Windows 10 without Laravel Homestead, you can enable the Linux subsystem and run your code through that.

https://www.windowscentral.com/how-install-bash-shell-command-line-windows-10

Then install the requirements:

sudo apt install php7.2-fpm php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-cli php7.2-zip php7.2-mysql

This also can run Laravel Envoy and Horizon too which don't work on Windows.

It's a nice lightweight solution.

Yggdrasil answered 20/8, 2018 at 9:12 Comment(3)
can this run Nginx, MySQL, MongoDB, Supervisor, Crontabs and etc? cause if it can, it's like a mini server for development thenWilbertwilborn
The www.windowscentral.com link is (effectively) broken: "No articles found. The page you requested currently has no articles listed."Veronaveronese
@PeterMortensen the link seems back to normal, I can access it todayHeulandite
L
3

You may consider using: --ignore-platform-reqs ext-pcntl when installing via commands.

Further information is at Laravel Horizon, ext-pcntl and Windows.

Langtry answered 9/8, 2022 at 8:48 Comment(0)
U
2

Just this command helped me to update the composer

composer update --ignore-platform-reqs

these pcntl and posix extension are for UNIX like systems

Undulate answered 6/1 at 7:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.