I'm getting error “Class 'Predis\Client' not found” in Laravel 5.2

前端 未结 7 1607
自闭症患者
自闭症患者 2020-12-03 04:39

I want to using Redis in laravel 5.2 however, I\'m getting error such a Class \'Predis\\Client\' not found, How I can solve it.

7条回答
  •  攒了一身酷
    2020-12-03 04:47

    Btw, if you are using laravel workers, with ubuntu supervisor and this error will not dissappear even after you did

    composer require predis/predis
    

    Then remember kids, that supervisor caches all your php code, once you boot it. So installing predis after you booted supervisor workers (https://laravel.com/docs/5.6/queues#supervisor-configuration), will not make a difference, until you do

    sudo supervisorctl stop laravel-worker:*
    

    and then start it again

    sudo supervisorctl start laravel-worker:*
    

    I've been stuck on this for an hour or two, on 3 projects in the last year.

提交回复
热议问题