如何解决“laravel/horizo​​n v1.1.0 需要 ext-pcntl * -> 系统中缺少请求的 PHP 扩展 pcntl”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48577465/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 02:41:38  来源:igfitidea点击:

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

phplaravelcomposer-phplaravel-5.5laravel-horizon

提问by Success Man

When I run composer installon command promp, there exist error like this :

当我composer install在命令提示符上运行时,存在如下错误:

  Problem 1
    - Installation request for laravel/horizon v1.1.0 -> satisfiable by laravel/horizon[v1.1.0].
    - laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.

  To enable extensions, verify that they are enabled in your .ini files:
    - C:\xampp-7.1\php\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

How can I solve this error?

我该如何解决这个错误?

回答by

Run composer with the --ignore-platform-reqsoption and specify pcntland posix

使用--ignore-platform-reqs选项运行 composer并指定pcntlposix

composer install --ignore-platform-reqs

回答by dailysleaze

As per the accepted answer, but you can add this to your composer.json so that you don't have to run --ignore-platform-reqsall the time

按照接受的答案,但你可以添加到您的composer.json,这样你就不必运行--ignore-platform-reqs所有的时间

"config": {
  "platform": {
    "ext-pcntl": "7.3",
    "ext-posix": "7.3"
  }
}

回答by Sapnesh Naik

pcntlextension is not supported on Windows. (based on your XAMPP information)

pcntlWindows 不支持扩展。(基于您的 XAMPP 信息)

Please see these github issues on laravel/horizonpage #131, #78.

请在laravel/horizo​​n页面#131, #78上查看这些 github 问题。

I suggest you use Laravel Homesteadon your Windows system, It is easy to setup and will save you from many of the similar problems in future.

我建议你在你的 Windows 系统上使用Laravel Homestead,它很容易设置并且可以避免你将来遇到许多类似的问题。

回答by Saurabh Mistry

install horizon this way :

以这种方式安装地平线:

composer require laravel/horizon --ignore-platform-reqs

then run

然后运行

php artisan horizon:install

回答by Trey Copeland

Just run the following:

只需运行以下命令:

composer install --ignore-platform-reqs

composer install --ignore-platform-reqs

Note: pcntl is not supported on Windows

注意:Windows 不支持 pcntl

回答by Patrick.SE

If you are using docker based on a Unix image you can add it with the docker utility:

如果您使用基于 Unix 映像的docker,您可以使用docker 实用程序添加它:

docker-php-ext-install pcntl

You can then confirm that this extension is installed and enabled inside of your container:

然后,您可以确认在您的容器内安装并启用了此扩展:

?> php -i | grep pcntl
/usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini,
pcntl
pcntl support => enabled

回答by Roland Allla

I have installed PHP 7.2 instead of 7.1 and everything works fine now. It appears that pcntl was not present in 7.1 but it's installed with php 7.2.

我已经安装了 PHP 7.2 而不是 7.1,现在一切正常。看来 pcntl 在 7.1 中不存在,但它与 php 7.2 一起安装。

回答by FloatingKiwi

If you're running on windows 10 without homestead you can enable the linux subsystem and run horizon 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

This also can run laravel envoy too which doesn't work on windows.

这也可以运行 laravel envoy,但在 Windows 上不起作用。

It's a nice lightweight solution

这是一个很好的轻量级解决方案

回答by Charleskimani

$composer install --ignore-platform-reqs ext-pcntl

回答by Beranda Kreatif

I have some problem and composer install --ignore-platform-reqsworks for me

我有一些问题并且composer install --ignore-platform-reqs对我有用

Thanks

谢谢