Skip to content

Commit 3a6d0ba

Browse files
[5.x] Fail fast when Redis is not installed (#1705)
* Fail fast when Redis is not installed or not reachable * Update HorizonCommand.php --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent acb34f3 commit 3a6d0ba

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Console/HorizonCommand.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ class HorizonCommand extends Command
3333
*/
3434
public function handle(MasterSupervisorRepository $masters)
3535
{
36+
$client = config('database.redis.client');
37+
38+
if ($client === 'phpredis' && ! extension_loaded('redis')) {
39+
return $this->components->error('The PHP Redis extension is not installed.');
40+
}
41+
42+
if ($client === 'predis' && ! class_exists(\Predis\Client::class)) {
43+
return $this->components->error('Predis client is not installed. Run: composer require predis/predis');
44+
}
45+
3646
if ($masters->find(MasterSupervisor::name())) {
3747
return $this->components->warn('A master supervisor is already running on this machine.');
3848
}

0 commit comments

Comments
 (0)