74

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?

moses toh
  • 12,344
  • 71
  • 243
  • 443

15 Answers15

163

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

composer install --ignore-platform-reqs
Darryl Hein
  • 142,451
  • 95
  • 218
  • 261
  • 3
    There exist error like this : `Invalid argument ext-pcntl ext-posix. Use "composer require ext-pcntl ext-posix" instead to add packages to your composer.json.` – moses toh Feb 02 '18 at 08:06
  • 14
    Try it with only the option: `composer install --ignore-platform-reqs` –  Feb 02 '18 at 08:07
  • I just had the same issue - for some reason unknown to me, my php got _unlinked_ (??) somehow. I found out when running `php --ini` to locate the loaded config that I wanted to check, and it said no config is loaded, none. At the end, all I needed was to relink PHP by `brew link php71 --force` and dependencies installed without a problem. – Barnabas Kecskes May 03 '18 at 08:53
  • Thanks, composer install --ignore-platform-reqs worked for me! – Mangesh Sathe May 30 '18 at 07:56
  • See my answer if you don't always want to add `--ignore-platform-reqs` to every composer command https://stackoverflow.com/a/52778992/2623477 – dsturbid Oct 12 '18 at 14:14
  • 5
    This isn't fixing the problem, it's just ignoring the error. You still need the process-control extension enabled for horizon to work as it should. You should be upgrading your php installation – Shane N Feb 03 '20 at 22:39
  • Thanks, composer install --ignore-platform-reqs worked for me as well. – Wasim Khan Dec 30 '20 at 05:10
  • 2
    I don't think this is a solution. If you supress the message, then when you get around to running horizon (which we can assume you will because its in your composer.json) then you'll get an error stating that the extension is missing. – AaronHS Jan 05 '21 at 07:23
  • 1
    How is this the answer? – jonlink Oct 26 '21 at 20:41
99

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"
  }
}
dsturbid
  • 1,899
  • 1
  • 17
  • 24
23

install horizon this way :

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

then run

php artisan horizon:install
Saurabh Mistry
  • 12,833
  • 5
  • 50
  • 71
14

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.

Sapnesh Naik
  • 11,011
  • 7
  • 63
  • 98
  • 6
    ...and this is the better answer: how do you expect that library to work if you cannot install one of the required PHP extensions? – Nico Haase Feb 02 '18 at 09:08
  • @NicoHaase `--ignore-platform-reqs`... keyword being `platform`. It runs on windows without those dependencies throwing a wench in the installation process. https://okaufmann.ch/development/laravel-horizon-ext-pcntl-and-windows/ –  Feb 02 '18 at 09:13
  • 1
    Yes, I'm aware of that. But there must be any reason that the library requires these extensions - if they are required for the library to work properly and you ignore this requirement, they won't work properly – Nico Haase Feb 02 '18 at 09:57
  • 5
    You're missing the point, they are required on Linux, not Windows. It works fine on Windows without the those extensions. –  Feb 02 '18 at 14:58
14

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
Patrick.SE
  • 4,444
  • 5
  • 34
  • 44
5

Just run the following:

composer install --ignore-platform-reqs

Note: pcntl is not supported on Windows

Trey Copeland
  • 3,387
  • 7
  • 29
  • 46
5

add this line

RUN docker-php-ext-install pcntl before

RUN composer install

javidasd
  • 1,126
  • 13
  • 18
3

This works for me

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

Hopefully it will help.

Md Aman Ullah
  • 486
  • 1
  • 5
  • 17
2

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
jonlink
  • 542
  • 6
  • 18
1

You need to install the package while ignoring the platform requirements.

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

Then run

php artisan horizon:install
0

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.

Roland Allla
  • 388
  • 4
  • 13
0

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

FloatingKiwi
  • 4,408
  • 1
  • 17
  • 41
0
$composer install --ignore-platform-reqs ext-pcntl
Dharman
  • 30,962
  • 25
  • 85
  • 135
Charleskimani
  • 440
  • 7
  • 25
0

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

Thanks

  • 6
    Please don't add _"thanks"_ as answers. They don't actually provide an answer to the question, and can be perceived as noise by its future visitors. Once you [earn](http://meta.stackoverflow.com/q/146472) enough [reputation](http://stackoverflow.com/help/whats-reputation), you will gain privileges to [upvote answers](http://stackoverflow.com/help/privileges/vote-up) you like. This way future visitors of the question will see a higher vote count on that answer, and the answerer will also be rewarded with reputation points. See [Why is voting important](http://stackoverflow.com/help/why-vote). – Yunnosch Mar 27 '20 at 10:52
0

If you use Windows and get that issue - you should just ignore it since Horizon works fine without the extension and doesn't require it on Windows.

So basically you must use the next

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

Good luck!

Taras Chernata
  • 371
  • 8
  • 17