skip to Main Content

Memcache error on yii migrate.

exception ‘yiibaseInvalidConfigException’ with message ‘MemCache
requires PHP memcache extension to be loaded.’

in /Applications/AMPPS/www/G2G/vendor/yiisoft/yii2/caching/MemCache.php:220

Stack trace:
#0 /Applications/AMPPS/www/G2G/vendor/yiisoft/yii2/caching/MemCache.php(116):
yiicachingMemCache->getMemcache()

I have memcached installed on my laptop and in my php its active as well. But still getting above error. Any reason to this?

Config

 'cache' => [
        'class' => 'yiicachingMemCache',
        'servers' => [
            [
                'host' => '127.0.0.1',
                'port' => 11211
            ],
        ],
    ],

2

Answers


  1. If you have installed memcached, you need to configure your component to use it:

    'cache' => [
        'class' => 'yiicachingMemCache',
        'useMemcached' => true,
        'servers' => [
            [
                'host' => '127.0.0.1',
                'port' => 11211
            ],
        ],
    ],
    

    MemCache::$useMemcached documentation:

    Whether to use memcached or memcache as the underlying caching extension. If true, memcached will be used. If false, memcache will be used. Defaults to false.

    Login or Signup to reply.
  2.  'cache' => [
            'class' => 'yiicachingFileCache',
        ],
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search