Laravel/Lumen: Could not establish Memcached connection

5.3k Views Asked by At

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?

2

There are 2 best solutions below

6
On BEST ANSWER

Are you sure memcached itself is running?

sudo service memcached status

If it's off you need to start it.

0
On

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!