I'm going crazy about this error. I've got a vagrant VM with Debian 7, generated with Puphpet, installation was fine.
redis-server
is running :
I can use the server on 127.0.0.1:6379
:
php5-redis
is actually installed :
Here is my redis config file in app/local/database.php
:
'redis' => [
'cluster' => false,
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
],
// Get redis
$redis = Redis::connection();
sudo service nginx reload
sudo service redis-server force-reload
composer dumpautoload
But nothing solved the error.
I'm still having :
ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined method Redis::connection()' in /var/www/fd/app/menus/admin.menu.php:16
(line 16 is where I do the connection $redis = Redis::connection();
)
Where am I wrong ?
Btw, I hate mondays >.>
I came across this after encountering this issue and wanted to add another answer in case it helps someone else.
In my case there was an alias collision because my php configuration has the PHP-Redis module/extension enabled -- both the PHP module and Laravel seem to have a conflicting object named Redis. I was able to resolve this simply by using the entire namespaced identifier:
//$r = Redis::connection()
$r = Illuminate\Support\Facades\Redis::connection();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With