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

16

78

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?

Overgrowth answered 2/2, 2018 at 7:11 Comment(0)
S
176

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

composer install --ignore-platform-reqs
Stamper answered 2/2, 2018 at 8:2 Comment(10)
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.Overgrowth
Try it with only the option: composer install --ignore-platform-reqsStamper
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.Sonia
Thanks, composer install --ignore-platform-reqs worked for me!Flare
See my answer if you don't always want to add --ignore-platform-reqs to every composer command https://mcmap.net/q/262564/-how-can-i-solve-quot-laravel-horizon-v1-1-0-requires-ext-pcntl-gt-the-requested-php-extension-pcntl-is-missing-from-your-system-quotWarty
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 installationJocose
Thanks, composer install --ignore-platform-reqs worked for me as well.Tweezers
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.Jemappes
How is this the answer?Analisaanalise
If the intention is not to run Horizon in this install (e.g. for local development), then this is a fine workaround; ext-pcntl isn't supported in WindowsNursemaid
W
107

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"
  }
}
Warty answered 12/10, 2018 at 11:53 Comment(4)
I've been looking everywhere for this. Thank you!Allyl
added this but it didn't fix mine. I'm running PHP 7.3 on MAMP (on a mac)Loeffler
Perfect for me, this solution worked in a window 10 PHP 7.4.15Godless
Perfect: Worked with windows 10, PHP 8.0.3Snowberry
C
28

install horizon this way :

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

then run

php artisan horizon:install
Caucasia answered 5/2, 2019 at 6:35 Comment(0)
E
17

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.

Embarrassment answered 2/2, 2018 at 7:20 Comment(4)
...and this is the better answer: how do you expect that library to work if you cannot install one of the required PHP extensions?Bombast
@NicoHaase --ignore-platform-reqs... keyword being platform. It runs on windows without those dependencies throwing a wench in the installation process. okaufmann.ch/development/laravel-horizon-ext-pcntl-and-windowsStamper
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 properlyBombast
You're missing the point, they are required on Linux, not Windows. It works fine on Windows without the those extensions.Stamper
T
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
Tetrahedron answered 16/9, 2019 at 12:38 Comment(0)
W
5

Just run the following:

composer install --ignore-platform-reqs

Note: pcntl is not supported on Windows

Weizmann answered 14/3, 2019 at 18:1 Comment(0)
S
5

add this line

RUN docker-php-ext-install pcntl before

RUN composer install

Silicious answered 8/1, 2022 at 18:54 Comment(0)
L
5

This works for me

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

Hopefully it will help.

Lanark answered 19/4, 2022 at 10:29 Comment(0)
A
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
Analisaanalise answered 26/10, 2021 at 20:48 Comment(0)
T
1

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!

Tripping answered 7/8, 2022 at 13:12 Comment(1)
This should be the accepted answer as it explains why you can ignore the platform requirements on windows and that the package still works.Clothespin
C
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
Chane answered 20/10, 2022 at 6:26 Comment(0)
F
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

Festival answered 20/8, 2018 at 9:10 Comment(0)
D
0
$composer install --ignore-platform-reqs ext-pcntl
Diffuser answered 16/11, 2019 at 5:13 Comment(0)
B
0

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

Thanks

Belcher answered 27/3, 2020 at 10:41 Comment(1)
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 enough reputation, you will gain privileges to upvote answers 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.Then
F
0
composer install --ignore-platform-reqs   

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

php artisan horizon:install
Fustanella answered 29/11, 2023 at 14:3 Comment(1)
Please take the tour and read How to Answer.Then
L
-1

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.

Languish answered 9/8, 2018 at 8:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.