如何在 Windows 中安装 PCNTL 扩展?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30045085/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install PCNTL extension in Windows?
提问by Yogesh
I am running PHPUnit in Windows and trying to install PHPUnit via composer.json:
我在 Windows 中运行 PHPUnit 并尝试通过composer.json安装 PHPUnit :
"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.
phpunit/php-invoker 1.1.3 需要 ext-pcntl * -> 系统中缺少请求的 PHP 扩展 pcntl。
How can I install this extenstion?
如何安装此扩展?
回答by Aleksander Wons
You can't install ext-pcntl extension on Windows. Accordingly to the PHP documentation:
你不能在 Windows 上安装 ext-pcntl 扩展。根据 PHP 文档:
Currently, this module will not function on non-Unix platforms (Windows).
目前,该模块在非 Unix 平台 (Windows) 上不起作用。
If you want to install PHPUnit all you need is the PHPUnit library:
如果你想安装 PHPUnit,你只需要 PHPUnit 库:
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.
你不需要 php-invoker 来安装 PUPUnit。但是,如果您还需要 php-invoker 库,那您就不走运了。尝试使用 Vagrant 或带有 Linux 发行版(如 Ubuntu、Debian 或 Mint)的普通 VM。
回答by FloatingKiwi
If you're running on windows 10 without homestead you can enable the linux subsystem and run your code through that.
如果您在没有 homestead 的情况下在 Windows 10 上运行,您可以启用 linux 子系统并通过它运行您的代码。
https://www.windowscentral.com/how-install-bash-shell-command-line-windows-10
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
sudo apt 安装 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.
这也可以运行在 Windows 上不起作用的 laravel envoy 和地平线。
It's a nice lightweight solution
这是一个很好的轻量级解决方案