[英]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我已经按照文档成功安装并设置了 laravel-horizon
when i running this command php artisan horizon
当我运行这个命令
php artisan horizon
it throws below error :它抛出以下错误:
Symfony\\Component\\Debug\\Exception\\FatalThrowableError : Call to undefined function Laravel\\Horizon\\Console\\pcntl_async_signals()
Symfony\\Component\\Debug\\Exception\\FatalThrowableError:调用未定义的函数 Laravel\\Horizon\\Console\\pcntl_async_signals()
When i open http://127.0.0.1:8000/horizon/dashboard , horizon dashboard status always inactive当我打开http://127.0.0.1:8000/horizon/dashboard 时,地平线仪表板状态始终处于非活动状态
Im using XAMPP , PHP Version 7.3.0 , Laravel version 5.7我使用 XAMPP,PHP 版本 7.3.0,Laravel 版本 5.7
I have followed this link : https://github.com/laravel/horizon/issues/154#issuecomment-366712260我已经按照这个链接: 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 .我搜索了很多问题,但没有运气,也尝试过
composer update --ignore-platform-reqs
但仍然无法正常工作。
anyone please help me to run Laravel Horizon in my local system任何人请帮助我在本地系统中运行 Laravel Horizon
After searching 2 hours finally i resolved error : 经过2小时的搜索,我终于解决了错误:
As Im using XAMPP , i have to set PATH
in bash_profile
file to use XAMPP's php 7.3.0 由于我使用XAMPP,我必须在
bash_profile
文件中设置PATH
才能使用XAMPP的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 , 然后使用重新加载bash_profile,
source ~/.bash_profile
then i Check php version by 然后我检查php版本
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
PHP 7.3.0(CLI)(内置:2018年12月11日01:01:47)(NTS)版权所有(c)1997-2018 The PHP Group Zend Engine v3.3.0-dev,版权所有(c)1998-2018 Zend Technologies
then i check php -i | grep pcntl
然后我检查
php -i | grep pcntl
php -i | grep pcntl
it will display : 它会显示:
pcntl support => enabled
pcntl支持=>已启用
so i try to run php artisan horizon
, again got same error after enable pcntl 所以我尝试运行
php artisan horizon
,启用pcntl后再次遇到相同的错误
i was try to running composer dump-autoload
, so got new error 我试图运行
composer dump-autoload
,所以出现了新错误
so to solve this error I have added pcre.jit=0
in php.ini file 因此,为解决此错误,我在php.ini文件中添加了
pcre.jit=0
Applications/XAMPP/xamppfiles/etc/php.ini
from this link : https://github.com/composer/composer/issues/7836#issuecomment-447287797 从此链接: https : //github.com/composer/composer/issues/7836#issuecomment-447287797
finally restarted apache server from XAMPP , and run composer dump-autoload
最终从XAMPP重新启动了apache服务器,并运行
composer dump-autoload
then last run php artisan horizon
gives me cleaner output like 然后最后运行
php artisan horizon
给我更干净的输出
Horizon started successfully.
Horizon成功启动。
This error is irrelevant to laravel and horizon.这个错误与 Laravel 和地平线无关。
pcntl_async_signals() is a php method a link . pcntl_async_signals() 是一个 php 方法 链接。 to enable PCNTL you should compile php with pcntl
要启用 PCNTL,您应该使用 pcntl 编译 php
if you use DirectAdmin as control Panel you can use this instructions : Click here !如果您使用 DirectAdmin 作为控制面板,您可以使用以下说明:单击 此处!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.