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

Php Problem Overview


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

  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?

Php Solutions


Solution 1 - Php

Run composer with the --ignore-platform-reqs option and specify pcntl and posix

composer install --ignore-platform-reqs

Solution 2 - Php

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

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

Solution 3 - Php

install horizon this way :

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

then run

php artisan horizon:install

Solution 4 - Php

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

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

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

Solution 5 - Php

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

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

Solution 6 - Php

Just run the following:

composer install --ignore-platform-reqs

Note: pcntl is not supported on Windows

Solution 7 - Php

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.

Solution 8 - Php

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

Thanks

Solution 9 - Php

This works for me

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

Hopefully it will help.

Solution 10 - Php

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

It's a nice lightweight solution

Solution 11 - Php

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

Solution 12 - Php

The answer to simply ignore the dependency is wrong. That isn't going to give you a working version of Horizon or whatever package you may be hoping to install. The dependencies must be installed.

Examples of how to install:

APK

sudo add php8-pcntl php8-pcntl

Yum

sudo yum install -y php-pcntl php-posix

Solution 13 - Php

add this line

RUN docker-php-ext-install pcntl before

RUN composer install

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSuccess ManView Question on Stackoverflow
Solution 1 - Phpuser320487View Answer on Stackoverflow
Solution 2 - PhpdsturbidView Answer on Stackoverflow
Solution 3 - PhpSaurabh MistryView Answer on Stackoverflow
Solution 4 - PhpSapnesh NaikView Answer on Stackoverflow
Solution 5 - PhpPatrick.SEView Answer on Stackoverflow
Solution 6 - PhpTrey CopelandView Answer on Stackoverflow
Solution 7 - PhpRoland AlllaView Answer on Stackoverflow
Solution 8 - PhpBeranda KreatifView Answer on Stackoverflow
Solution 9 - PhpMd Aman UllahView Answer on Stackoverflow
Solution 10 - PhpFloatingKiwiView Answer on Stackoverflow
Solution 11 - PhpCharleskimaniView Answer on Stackoverflow
Solution 12 - PhpjonlinkView Answer on Stackoverflow
Solution 13 - PhpjavidasdView Answer on Stackoverflow