简体   繁体   中英

Laravel Horizon throws error : Call to undefined function Laravel\Horizon\Console\pcntl_async_signals()

i have succesfully installed and setup laravel-horizon as per documentation

when i running this command php artisan horizon

it throws below error :

Symfony\\Component\\Debug\\Exception\\FatalThrowableError : Call to undefined function Laravel\\Horizon\\Console\\pcntl_async_signals()

在此处输入图片说明

When i open http://127.0.0.1:8000/horizon/dashboard , horizon dashboard status always inactive

在此处输入图片说明

Im using XAMPP , PHP Version 7.3.0 , Laravel version 5.7

I have followed this link : https://github.com/laravel/horizon/issues/154#issuecomment-366712260

composer require ext-pcntl ext-posix

here is composer :

"require": {
        "php": "^7.1.3",
        "ext-pcntl": "^7.2",
        "ext-posix": "^7.2",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/horizon": "^2.0",
        "laravel/socialite": "^4.0",
        "laravel/tinker": "^1.0",
        "predis/predis": "^1.1",
    },

I have search so many questions , but no luck , also tried composer update --ignore-platform-reqs but still not working .

anyone please help me to run Laravel Horizon in my local system

After searching 2 hours finally i resolved error :

As Im using XAMPP , i have to set PATH in bash_profile file to use XAMPP's php 7.3.0

so I added this in

sudo nano ~/.bash_profile

export XAMPP_HOME=/Applications/XAMPP
export PATH=${XAMPP_HOME}/bin:${PATH}

then reload bash_profile using ,

source ~/.bash_profile

then i Check php version by

php -v

it will display below :

PHP 7.3.0 (cli) (built: Dec 11 2018 01:01:47) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies

then i check php -i | grep pcntl php -i | grep pcntl

it will display :

pcntl support => enabled

so i try to run php artisan horizon , again got same error after enable pcntl

i was try to running composer dump-autoload , so got new error

在此处输入图片说明

so to solve this error I have added pcre.jit=0 in php.ini file

Applications/XAMPP/xamppfiles/etc/php.ini

from this link : https://github.com/composer/composer/issues/7836#issuecomment-447287797

finally restarted apache server from XAMPP , and run composer dump-autoload

then last run php artisan horizon gives me cleaner output like

Horizon started successfully.

This error is irrelevant to laravel and horizon.
pcntl_async_signals() is a php method a link . to enable PCNTL you should compile php with pcntl
if you use DirectAdmin as control Panel you can use this instructions : Click here !

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