缓存引擎搜索未正确配置 Cakephp 2.4.3

Cache engine search is not properly configured Cakephp 2.4.3

蛋糕版本:2.4.3
PHP: 5.6
Redis: 6.0
Docker: 3.1

我是运行一个蛋糕项目2.4.3出现错误

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

APP\Config\bootstrap.php 第 159 行 → Cache::config(字符串,数组)

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

我该如何解决这个问题? 谢谢大家!

该错误消息可能有点误导,因为它不一定与配置相关,在后来的 2.x 版本中更改为:

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

检查这些东西,并尝试在CakePHP源代码中调试,redis连接正在RedisEngine::_connect()方法中建立,位于lib/Cake/Cache/Engine/RedisEngine.php.

可能的异常可能包含有用的信息。 $this->_Redis->getLastError() 也可能。

我发现问题是我的 PHP 5.6 扩展没有启用 Redis

安装 Redis 扩展 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

编辑文件php.ini添加

extension=redis.so

并重启服务器。享受!