Skip to content
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

Problem running horizon in laravel 6 #659

Closed
hexters opened this issue Sep 5, 2019 · 8 comments
Closed

Problem running horizon in laravel 6 #659

hexters opened this issue Sep 5, 2019 · 8 comments

Comments

@hexters
Copy link

hexters commented Sep 5, 2019

  • Horizon Version: 3.3
  • Laravel Version: 6.0
  • PHP Version: 7.2
  • Redis Driver & Version: predis/phpredis ?
  • Database Driver & Version: 4

Description:

I get error message when I try to running horizon in laravel 6 and this error is

LogicException  : Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.

  at /Users/tay/Sites/idpay/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:72
    68|     protected function createClient(array $config)
    69|     {
    70|         return tap(new Redis, function ($client) use ($config) {
    71|             if ($client instanceof RedisFacade) {
  > 72|                 throw new LogicException(
    73|                     'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'
    74|                 );
    75|             }
    76| 

  Exception trace:

  1   Illuminate\Redis\Connectors\PhpRedisConnector::Illuminate\Redis\Connectors\{closure}(Object(Illuminate\Support\Facades\Redis))
      /Users/tay/Sites/idpay/vendor/laravel/framework/src/Illuminate/Support/helpers.php:424

  2   tap(Object(Illuminate\Support\Facades\Redis), Object(Closure))
      /Users/tay/Sites/idpay/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:94

  Please use the argument -v to see more details.

and when I try to rename Redis Facade in config/app.php, I get diveren messege like this

 Symfony\Component\Debug\Exception\FatalThrowableError  : Class 'Redis' not found

  at /Users/tay/Sites/idpay/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:70
    66|      * @throws \LogicException
    67|      */
    68|     protected function createClient(array $config)
    69|     {
  > 70|         return tap(new Redis, function ($client) use ($config) {
    71|             if ($client instanceof RedisFacade) {
    72|                 throw new LogicException(
    73|                     'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'
    74|                 );

  Exception trace:

  1   Illuminate\Redis\Connectors\PhpRedisConnector::createClient()
      /Users/tay/Sites/idpay/vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:26

  2   Illuminate\Redis\Connectors\PhpRedisConnector::connect(["127.0.0.1", "6379"], ["redis", "laravel_database_"])
      /Users/tay/Sites/idpay/vendor/laravel/framework/src/Illuminate/Redis/RedisManager.php:109

  Please use the argument -v to see more details.

Steps To Reproduce:

@driesvints
Copy link
Member

Redis Driver & Version: predis/phpredis ?

Which driver are you using? If phpredis: do you have the ext-redis extension installed as documented here: https://laravel.com/docs/6.0/redis#introduction ?

@JavBautista
Copy link

1 Replace in config\app.php
aliasess:
'Redis' => Illuminate\Support\Facades\Redis::class,
for:
'RedisManager' => Illuminate\Support\Facades\Redis::class,

2 Replace in config\database.php

'redis' => [

    'client' => env('REDIS_CLIENT', 'predis'), //default phpredis
    ...

@driesvints
Copy link
Member

Looks like you got bitten by the change to the skeleton as well. We added a note about this in the upgrade guide: https://laravel.com/docs/6.0/upgrade#redis-default-client. Try the solution from @JavBautista

@hexters
Copy link
Author

hexters commented Sep 6, 2019

Problem solve I change redis clinet from phpredis to predis.

Thanks for all

@depsimon
Copy link

Solved it by running pecl install redis on Mac OS and then valet restart (if you don't use valet, restart PHP)

@jandante
Copy link

I still have this problem. Running Horizon gives me:

 Error 

  Class 'Redis' not found

  at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:74
    70|      * @throws \LogicException
    71|      */
    72|     protected function createClient(array $config)
    73|     {
  > 74|         return tap(new Redis, function ($client) use ($config) {
    75|             if ($client instanceof RedisFacade) {
    76|                 throw new LogicException(
    77|                         extension_loaded('redis')
    78|                                 ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'

  • A class import is missing: You have a missing class import. Try importing this class: `Illuminate\Support\Facades\Redis`. 

      +22 vendor frames 
  23  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

I have redis correctly installed. This route returns me the key that I've set.

Route::get('/redis', function () {
    $app = RedisManager::connection();
    $app->set('key', 'Redis is working just fine');
    echo $app->get('key');
});

I also changed the Facade from 'Redis' to 'RedisManager'. I'm not using predis if i am correct.
I'm using valet linux with PHP 7.3 FPM.

@mic7x4
Copy link

mic7x4 commented Jul 28, 2021

My problem now is who can help?
Redis::connect
vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:135

@Chienle
Copy link

Chienle commented Aug 7, 2021

My problem now is who can help?
Redis::connect
vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:135

did you resolve it ?

I got same your issue and fixed it later inside docker config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants