Cache engine search is not properly configured Cakephp 2.4.3

1.4k Views Asked by At

Cake version: 2.4.3
PHP: 5.6
Redis: 6.0
Docker: 3.1

I am running a cake project 2.4.3 and have an error

Cache engine search is not properly configured.
Error: An Internal Error Has Occurred.

APP\Config\bootstrap.php line 159 → Cache::config(string, array)

'search'
array(
    'port' => '*****',
    'prefix' => '*****',
    'engine' => 'Redis',
    'server' => '172.30.1.5',
    'duration' => (int) 1
)

How can I fix this? Thank everyone!

2

There are 2 best solutions below

0
tranthaihoang On BEST ANSWER

I found out the problem is that my PHP 5.6 extensions are not Redis enabled

Install Redis extension PHP5.6

apt-get install wget
mkdir ~/redis
cd ~/redis
wget  https://pecl.php.net/get/redis-2.2.8.tgz
tar zxpf redis*
cd redis*
phpize
./configure --with-option=/path/etc
make && make install

Edit file php.ini add

extension=redis.so

And restart server. enjoy!

1
ndm On

That error message can be a little misleading, as its not necessarily related to the configuration, it was changed in later 2.x versions to say:

Cache engine "%s" is not properly configured. Ensure required extensions are installed, and credentials/permissions are correct

Check these things, and try to debug in the CakePHP source code, the redis connection is being established in the RedisEngine::_connect() method, located in lib/Cake/Cache/Engine/RedisEngine.php.

The possible exception might hold helpful information. $this->_Redis->getLastError() might too.