简体   繁体   中英

Error while installing Laravel Horizon on Windows

In Windows 10 Home Basic I get the following error while installing Laravel Horizon.

I have PHP version 7.1.9 running on Xampp.

$ composer require laravel/horizon

Your requirements could not be resolved to an installable set of packages.

Problem 1 : - laravel/horizon v1.0.8 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.

This error indicates that the PCNTL PHP extension is not installed, and that Horizon requires a PHP environment that provides this extension.

The PCNTL extension provides an API for Unix-style process management and signaling. Because of its inherent focus on facilities only available in Unix- or Linux-like operating systems, this extension does not support Windows as described in the documentation :

Note: This extension is not available on Windows platforms.

From this API, Laravel Horizon uses the async signal handling feature that's new to PHP 7.1 to manage queue worker processes. For this reason, Horizon does not currently support Windows, and Windows developers need to use a virtual environment, such as Homestead , to install and run Horizon.

At the time of writing, this reflects the official position of the Laravel team regarding this issue.

Add "laravel/horizon": "^4.0", in composer.json and for install Horizon run command

composer install --ignore-platform-reqs

For start Horizon in windows you can use command

php artisan queue:listen --queue=default,horizon

Go to composer.json and under config , add this

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

So, from the next time, you won't have to use --ignore-platform-reqs anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM