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

半腔热情 提交于 2019-12-02 19:05:30

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

composer install --ignore-platform-reqs

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": "7.2",
    "ext-posix": "7.2"
  }
}

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.

install horizon this way :

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

then run

php artisan horizon:install

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.

Just run the following:

composer install --ignore-platform-reqs

Note: pcntl is not supported on Windows

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!