How to install PCNTL extension in Windows?

旧巷老猫 提交于 2019-12-04 18:02:55

问题


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?


回答1:


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.




回答2:


If you're running on windows 10 without 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



来源:https://stackoverflow.com/questions/30045085/how-to-install-pcntl-extension-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!