-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Artisan::call('horizon:terminate') The command "horizon:terminate" does not exist. #28217
Comments
You need to have Horizon installed for this. This is the issue tracker for the Laravel framework, not Horizon. |
@driesvints That is the problem, Horizon is already installed and it says command not found |
Can you first please try one of the following support channels? If you can actually identify this as a bug, feel free to report back and I'll gladly help you out. Thanks! |
@shadoWalker89 Not sure where you're calling that Artisan command, but you can only call that through the "terminal". Hope this https://github.com/laravel/horizon/blob/3.0/src/HorizonServiceProvider.php#L168 helps to understand the cause perhaps? |
@brunogaspar Thanks, that explains why i'm getting command not found. For now what i'm doing exec('cd '.base_path().' && /usr/local/bin/ea-php72 artisan horizon:terminate'); |
@brunogaspar About why i'm calling that command, like i said in the issue message, the administrator of the application can change configurations saved within the .env file. I need to terminate horizon so it can pickup the new config values |
Yup, figured much. Your solution is not bad, although not super Laravel Clean :) |
Ran into the same issue (with another package). It seems only commands registered outside of the Made a little write up explaining my solution. In my case, I'm the maintainer of the package and could easily work around the limitation by taking the command I want to use in Laravel out of the But I just tested that you can register the For instance, I did this.
While the |
I tried that out ... after some research in the laravel files I tried to set the commands up via the
But now I am running into new issues (i.e. horizoncommand: |
Just did this as you suggested and the terminate command works for me. All the multiple horizon instances are terminated instantly on my local machine. Still have to test on the server.
I am on Laravel 8 so may be that's why it worked for me without any error. |
Laravel 10 <?php
namespace App\Console;
use Laravel\Horizon\Console\TerminateCommand;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__ . '/Commands');
$this->registerCommand(new TerminateCommand());
require base_path('routes/console.php');
}
} Works perfect! |
Description:
Calling this from my application will cause this error
Symfony \ Component \ Console \ Exception \ CommandNotFoundException
The command "horizon:terminate" does not exist.
When i call the command from the command line it works.
If you ask why i'm calling the
horizon:terminate
from my application, well i have a settings module that allows users to update the application configuration by updating the .env file.After doing so,
I want to do two things
The config:cache works but the horizon:terminate does not.
The text was updated successfully, but these errors were encountered: