Horizon: Command "horizon" is not defined.

Created on 4 Sep 2017  路  9Comments  路  Source: laravel/horizon

Hello, I have this problem only when I run it with supervisor. It's interesting that locally with homestead works, but on productions I got this.

[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "horizon" is not defined.
Content-type: text/html; charset=UTF-8

php artisan --version
Laravel Framework 5.5.1

[program:laravel-horizon]
directory=/home/myuser/mydomain.com
process_name=%(program_name)s_%(process_num)02d
command=php /home/myuser/mydomain.com/artisan horizon
autostart=true
autorestart=true
user=myuser
numprocs=1
redirect_stderr=true
stdout_logfile=/home/myuser/mydomain.com/storage/logs/horizon.log

When I run from console

php /home/myuser/mydomain.com/artisan horizon

it works like a charm.

Any ideas?

Most helpful comment

Just wanted to give an update on my situation - that may help @RRStoyanov and other that faced similar problems. So I've managed to start supervisor with(for now) all sides working properly with one new property added.

[program:horizon]
process_name=%(program_name)s
command=/opt/cpanel/ea-php71/root/usr/bin/php  /home/app/laravel/artisan horizon
directory=/home/app/laravel
environment=PATH="/usr/local/bin"
stdout_logfile=/home/app/laravel/storage/logs/horizon.log
redirect_stderr=true
autostart=true
autorestart=true

environment=PATH="/usr/local/bin" <--- so this line solved my problems. Don't ask me why.

All 9 comments

When I changed command to full PHP path

command=/opt/cpanel/ea-php71/root/usr/bin/php /home/myuser/mydomain.com/artisan horizon

started to work

Close the issue if you think it's not related to horizon at all.

I just notice, that now it shows

`````
[2017-09-05 05:23:20] staging.ERROR: There are no commands defined in the "horizon" namespace. {"exception":"[object] (Symfony\Component\Console\Exception\CommandNotFoundException(code: 0): There are no commands defined in the \"horizon\" namespace. at /home/studio77d/mysite.com/vendor/symfony/console/Application.php:548)
[stacktrace]

0 /home/studio77d/mysite.com/vendor/symfony/console/Application.php(582): Symfony\Component\Console\Application->findNamespace('horizon')

1 /home/studio77d/mysite.com/vendor/symfony/console/Application.php(205): Symfony\Component\Console\Application->find('horizon:supervi...')

2 /home/studio77d/mysite.com/vendor/symfony/console/Application.php(125): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

3 /home/studio77d/mysite.com/vendor/laravel/framework/src/Illuminate/Console/Application.php(82): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

4 /home/studio77d/mysite.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(119): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

5 /home/studio77d/mysite.com/artisan(34): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

6 {main}

`````

[program:horizon]
process_name=%(program_name)s
command=/opt/cpanel/ea-php71/root/usr/bin/php artisan horizon
directory=/home/app/laravel
stdout_logfile=/home/app/laravel/storage/logs/horizon.log
redirect_stderr=true
autostart=true
autorestart=true

This does not work. I get:

  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "horizon" is not defined.                               

Content-type: text/html; charset=UTF-8

I am using cpanel 60, php 7.1 , centos6.9 , laravel 5.5 on my remote VPS that is suffering from this problem . Everything worked like a charm on my local ubuntu 16.04 server... Is there a possible fix?

@neorganic - same here

Just wanted to give an update on my situation - that may help @RRStoyanov and other that faced similar problems. So I've managed to start supervisor with(for now) all sides working properly with one new property added.

[program:horizon]
process_name=%(program_name)s
command=/opt/cpanel/ea-php71/root/usr/bin/php  /home/app/laravel/artisan horizon
directory=/home/app/laravel
environment=PATH="/usr/local/bin"
stdout_logfile=/home/app/laravel/storage/logs/horizon.log
redirect_stderr=true
autostart=true
autorestart=true

environment=PATH="/usr/local/bin" <--- so this line solved my problems. Don't ask me why.

@neorganic seems to fix my instance as well! Thanks!

@neorganic this has also fixed my issue, thank you.

@neorganic same here, thanks!

@neorganic any ideia why that line solved the problem?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pmartelletti picture pmartelletti  路  4Comments

rossuhms picture rossuhms  路  5Comments

lasselehtinen picture lasselehtinen  路  3Comments

wturrell picture wturrell  路  5Comments

slavarazum picture slavarazum  路  3Comments