macosmemcachedlaravel-7

Laravel memcached


I am getting error like this php artisan cache:clear

Failed to clear cache. Make sure you have the appropriate permissions.

in my .env

CACHE_DRIVER=memcached

i have storage/framework/cache/data directory

in my Macbook m1 brew services info memcached
memcached (homebrew.mxcl.memcached) Running: ✔ Loaded: ✔

how can i solve the problem?

I tried to add a php extension for memcached like extension=memcached.so, but it didn't help. tried to restart memcached (brew services restart memcached), it also not helped. i do not know how to solve this problem, anyone knows the reason of error


Solution

  • Same happened in my case, problem was related with memcached port.

    1. Check you config.cache.php file if default value is 11211
    ...
    'port' => env('MEMCACHED_PORT', 11211),
    ...
    
    1. Check your .env file you may have MEMCACHED_PORT variable with different value, remove it or set
    ...
    MEMCACHED_PORT=11211
    ...
    

    if default is not exists in config file