Musterknabe
Musterknabe

Reputation: 6081

Laravel/Lumen: Could not establish Memcached connection

I wanted to use caching in my project and thought I'd use Memcached. For that, I installed memcached.

When I output my phpinfo(); I can see, that the extension exists

enter image description here

However, when wanting to use it with Cache::get(), I get the following error:

Could not establish Memcached connection.

I have the following values in my .env

MEMCACHED_HOST=127.0.0.1
MEMCACHED_PORT=11211

My php.ini has the following content for memcached

extension=memcached.so

What do I need to do, to use memcached now and establish a connection successfully?

Upvotes: 3

Views: 5358

Answers (2)

Gilberto Albino
Gilberto Albino

Reputation: 2745

The Exceptions says:

Could not establish Memcached connection

So, PHP Memcached "extension" can not "connect" to "Memcached".

Please, try installing:

sudo apt-get install memcached
sudo service memcached status

And you are ready to go!

Upvotes: 7

fire
fire

Reputation: 21531

Are you sure memcached itself is running?

sudo service memcached status

If it's off you need to start it.

Upvotes: 4

Related Questions