1

I am trying to run a yii project which I copied from server. The project is running fine on live server.

I installed wamp for that purpose, and using composer installed all packages. The project is using advanced yii template, when I goto http://localhost/nz-tool.nztours.de/backend/web/ to run backend index page. I get the following error

Invalid Configuration – yii\base\InvalidConfigException MemCache requires PHP memcache extension to be loaded.

Btw I am new to yii and php, so I maybe missing some configuration. Upon googling I found out that php_memcached.dll dll is missing. I copied and put it in the right folder C:\wamp64\bin\php\php7.4.26\ext and updated php.ini, even tried changing php versions. But still memCached dll is not loading.

When I run php --version, it complains of missing php_memCached.dll file.

Warning: PHP Startup: Unable to load dynamic library 'php_memcached.dll' (tried: c:/wamp64/bin/php/php7.4.26/ext/php_memcached.dll (The specified module could not be found.), c:/wamp64/bin/php/php7.4.26/ext/php_php_memcached.dll.dll (The specified module could not be found.)) in Unknown on line 0
PHP 7.4.26 (cli) (built: Nov 16 2021 18:15:31) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

I also followed this guide to install memcache service.

Additional info: I have tried xamp and still same issue.

Amir Dora.
  • 2,831
  • 4
  • 40
  • 61
  • 1
    You must install memcached as separate service, not just PHP extension. Or change Yii local config not to use memcached as cache mechanizm – Justinas Jun 17 '22 at 08:03
  • Also in ini file write without `php_` prefix: `extension=memcached;` – Justinas Jun 17 '22 at 08:05
  • I downloaded memCached.exe and followed this guide to install it. https://stackoverflow.com/a/59476617/3952885 – Amir Dora. Jun 17 '22 at 08:08
  • I am not quite sure how to set config to not use memCached, there is a boolean value for it in main.php. Setting it to `false` also didn't help @Justinas – Amir Dora. Jun 17 '22 at 08:53
  • The most simple way to fix this (for development purposes only) is to look for `yii\caching\MemCache` in your config files and change it to `yii\caching\FileCache`. With that the Yii will store cache data as files instead of trying to use memcache. – Michal Hynčica Jun 17 '22 at 13:56
  • You can try this way: https://stackoverflow.com/questions/3016656/how-to-enable-memcache-in-wamp – Dmitry Leiko Jun 20 '22 at 08:50

1 Answers1

2

Please check if you copied the memcached DLL file to the correct location.

Your PHP warning says something about

c:/wamp64/bin/php/php7.4.26/ext/php_php_memcached.dll.dll

and looked for

c:/wamp64/bin/php/php7.4.26/ext/php_memcached.dll

and in php.ini file, these configurations need to be set

extension=php_memcache.dll
[Memcache]
memcache.allow_failover = 1
memcache.max_failover_attempts=20
memcache.chunk_size =8192
memcache.default_port = 11211
Amir Dora.
  • 2,831
  • 4
  • 40
  • 61
SvenTUM
  • 784
  • 1
  • 6
  • 16
  • 1
    There were some additional configurations which i needed to add for it to work, I have edited your answer and added them. Additionally I changed required environment to development, for that no memcache was required. – Amir Dora. Jun 26 '22 at 22:11