When installing Laravel/Horizon based on Composer, an error is reported: Package Laravel/Horizon at version ~5.6 has requirements incompatible with your php version, php extensions and composer version
1. When installing Laravel/Horizon based on Composer, an error is reported: Package Laravel/Horizon at version ~5.6 has requirements incompatible with Your php version, php extensions and composer version. as shown in Figure 1
PS E:\wwwroot\larabbs> composer require "laravel/horizon:~5.6"
[InvalidArgumentException]
Package laravel/horizon at version ~5.6 has requirements incompatible with your PHP version, PHP extensions and Com
poser version:
- laravel/horizon v5.7.17 requires ext-pcntl * but it is not present.
- laravel/horizon v5.7.17 requires ext-posix * but it is not present.
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] []...
PS E:\wwwroot\larabbs>
2. Based on the prompt information, install the PHP extension: PCNTL, POSIX, but PCNTL is not available under Windows. as shown in Figure 2
3. In the end, it is finally decided to install it in local Windows first, and then run it in Linux. Enable option: –ignore-platform-reqs , ignore all platform requirements (PHP, HHVM, lib-* and ext-*) and force the installation, even if the local machine does not meet these requirements. The installation was successful. as shown in Figure 3
PS E:\wwwroot\larabbs> composer require "laravel/horizon:~5.6" --ignore-platform-reqs
./composer.json has been updated
Running composer update laravel/horizon
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking laravel/horizon (v5.7.17)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Downloading laravel/horizon (v5.7.17)
- Installing laravel/horizon (v5.7.17): Extracting archive
1 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: facade/ignition
Discovered Package: fruitcake/laravel-cors
Discovered Package: intervention/image
Discovered Package: laravel/horizon
Discovered Package: laravel/sail
Discovered Package: laravel/sanctum
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: mews/captcha
Discovered Package: mews/purifier
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: overtrue/laravel-lang
Discovered Package: summerblue/generator
Discovered Package: summerblue/laravel-active
Package manifest generated successfully.
83 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force
Copied Directory [\vendor\laravel\horizon\public] To [\public\vendor\horizon]
Publishing complete.
PS E:\wwwroot\larabbs>
4. After the installation is complete, the browser opens larabbs.local/horizon to access the console. in line with expectations. as shown in Figure 4
5. But you can’t use the horizon command to start the queue system and task monitoring. Error: call to undefined function laravel\horizon\console\pcntl_async_signals() . as shown in Figure 5
PS E:\wwwroot\larabbs> php artisan horizon
Horizon started successfully.
Error
Call to undefined function Laravel\Horizon\Console\pcntl_async_signals()
at E:\wwwroot\larabbs\vendor\laravel\horizon\src\Console\HorizonCommand.php:48
44▕ );
45▕
46▕ $this->info('Horizon started successfully.');
47▕
➜ 48▕ pcntl_async_signals(true);
49▕
50▕ pcntl_signal(SIGINT, function () use ($master) {
51▕ $this->line('Shutting down...');
52▕
1 E:\wwwroot\larabbs\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
Laravel\Horizon\Console\HorizonCommand::handle(Object(Laravel\Horizon\Repositories\RedisMasterSupervisorRepository))
2 E:\wwwroot\larabbs\vendor\laravel\framework\src\Illuminate\Container\Util.php:40
Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
PS E:\wwwroot\larabbs>
6. When installing other extensions, you also need to add parameters: –ignore-platform-reqs, otherwise an error will be reported. However, it is strongly recommended not to use this parameter, and there will be unpredictable problems in the future. as shown in Figure 6
PS E:\wwwroot\larabbs> composer require "spatie/laravel-permission:~3.0"
./composer.json has been updated
Running composer update spatie/laravel-permission
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/horizon is locked to version v5.7.17 and an update of this package was not requested.
- laravel/horizon v5.7.17 requires ext-pcntl * -> it is missing from your system. Install or enable PHP's pcntl extension.
To enable extensions, verify that they are enabled in your .ini files:
- C:\php-7.4.27\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
PS E:\wwwroot\larabbs> git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
PS E:\wwwroot\larabbs> composer require "spatie/laravel-permission:~3.0" --ignore-platform-reqs
./composer.json has been updated
Running composer update spatie/laravel-permission
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking spatie/laravel-permission (3.18.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Downloading spatie/laravel-permission (3.18.0)
- Installing spatie/laravel-permission (3.18.0): Extracting archive
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: facade/ignition
Discovered Package: fruitcake/laravel-cors
Discovered Package: intervention/image
Discovered Package: laravel/horizon
Discovered Package: laravel/sail
Discovered Package: laravel/sanctum
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: mews/captcha
Discovered Package: mews/purifier
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: overtrue/laravel-lang
Discovered Package: spatie/laravel-permission
Discovered Package: summerblue/generator
Discovered Package: summerblue/laravel-active
Package manifest generated successfully.
84 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force
Copied Directory [\vendor\laravel\horizon\public] To [\public\vendor\horizon]
Publishing complete.
PS E:\wwwroot\larabbs>





