6

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()

enter image description here

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

enter image description here

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

Saurabh Mistry
  • 12,833
  • 5
  • 50
  • 71
  • 2
    Can you verify that `pcntl` extension is installed and enabled? Are you running this on Windows? – Luka Peharda Feb 07 '19 at 06:07
  • im running on Mac OS 10.13.6 – Saurabh Mistry Feb 07 '19 at 06:10
  • Have you published `php artisan vendor:publish --provider="Laravel\Horizon\HorizonServiceProvider"` ? – Hiren Gohel Feb 07 '19 at 06:12
  • @HirenGohel , yes i have done – Saurabh Mistry Feb 07 '19 at 06:13
  • @SaurabhMistry: Ok, Seems like you don't have the `pcntl` extension installed as error show i think, can you try to install it? – Hiren Gohel Feb 07 '19 at 06:15
  • @HirenGohel , i have tried to install it using `composer install --ignore-platform-reqs ext-pcntl ext-posix ` but it is not working – Saurabh Mistry Feb 07 '19 at 06:19
  • @HirenGohel , i have followed this link : https://stackoverflow.com/questions/48577465/how-can-i-solve-laravel-horizon-v1-1-0-requires-ext-pcntl-the-requested-ph – Saurabh Mistry Feb 07 '19 at 06:19
  • @SaurabhMistry can you run `php -i | grep pcntl` and verify that `pcntl` and `pcntl support => enabled` is printed out? – Luka Peharda Feb 07 '19 at 06:24
  • @LukaPeharda , i have just tried `php -i | grep pcntl` nothing got printed , can you tell me what should i do ? – Saurabh Mistry Feb 07 '19 at 06:25
  • @SaurabhMistry that means that you didn't install and enable `pcntl`. Try and find some tutorial with instructions on how to install `pcntl` on XAMPP (as it seems that https://stackoverflow.com/questions/48577465/how-can-i-solve-laravel-horizon-v1-1-0-requires-ext-pcntl-the-requested-ph didn't work for you) – Luka Peharda Feb 07 '19 at 06:32
  • @LukaPeharda , i have successfully installed `composer require ext-pcntl ext-posix` , but still got same error – Saurabh Mistry Feb 07 '19 at 07:34

2 Answers2

2

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

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

enter image description here

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.

Saurabh Mistry
  • 12,833
  • 5
  • 50
  • 71
1

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!