Laravel / Lumen: Failed to establish Memcached connection

I wanted to use caching in my project and thought I would be using Memcached. For this I have installed memcached.

When I output mine phpinfo();

I see the extension exists

enter image description here

However, when you want to use it with Cache::get()

, I get the following error:

Failed to 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 and connect successfully?

+3


source to share


2 answers


Are you sure memcached itself is running?

sudo service memcached status



If you need it, you need to run it.

+4


source


Exceptions:

Failed to establish Memcached connection

So PHP Memcached "extension" cannot "connect" to "Memcached".



Please try to install:

sudo apt-get install memcached
sudo service memcached status

      

And you're ready to go!

+7


source







All Articles