Esity's avatar

Problem with Static Method Redis

So I am calling the Redis functionality inside my Laravel application. I have an environment set up on local machine and then I just set up an environment on an ubuntu openstack instance.

When I call \Redis::get('test'); it works just fine on my laptop however when I call it from my ubuntu instance I get this error message

Non-static method Redis::get() cannot be called statically, assuming $this from incompatible context

I have forced Laravel to 4.2.16 on both environments I have also confirmed I can access Redis on my laptop and ubuntu instance from both my laptop and ubuntu instance.

Any ideas would be much appreciated.

0 likes
5 replies
bobbybouwmann's avatar

I had that error in the past and I think it has something to do with your PHP version! Can you check if both use the same PHP version? I believe 5.3 and 5.4 have issues with this, 5.5+ should be fixed though ;)

Thelt's avatar

Hello,

Sorry for the answer to an old post, but it appear as first in google while i was looking for my solution.

If somebody has the same problem someday, here is the simple trick that fixed it for me :

delete : use Redis;

add : use Illuminate\Support\Facades\Redis;

8 likes

Please or to participate in this conversation.