gpt4 book ai didi

laravel - 尽管加载了扩展程序,但仍出现 'Please make sure the PHP Redis extension is installed and enabled.' 错误

转载 作者:行者123 更新时间:2023-12-03 06:41:23 49 4
gpt4 key购买 nike

我收到了 Please make sure the PHP Redis extension is installed and enabled. 的垃圾邮件在我的日志中,尽管有 redis.so安装在 MacOS 上的扩展。我通过运行 pecl install redis 安装了 Redis 扩展, 成功并显示以下消息:

Installing '/usr/local/Cellar/php/7.3.12/pecl/20180731/redis.so'
install ok: channel://pecl.php.net/redis-5.1.1
Extension redis enabled in php.ini

通过运行 phpinfo()tinker ,我可以看到我加载的 php.ini
Configuration File (php.ini) Path => /usr/local/etc/php/7.3
Loaded Configuration File => /usr/local/etc/php/7.3/php.ini

如果我打开 /usr/local/etc/php/7.3/php.ini , extension="redis.so"列在文件的顶部。

让这越来越奇怪的是,如果我深入挖掘原始 Please make sure the PHP Redis extension is installed and enabled.的地方错误来自,它看起来在 laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:76 ,看起来像这样:
throw new LogicException(extension_loaded('redis') ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'  : 'Please make sure the PHP Redis extension is installed and enabled.');

所以根据这个,分机 不是 加载。但是如果我加载 tinker再次运行 extension_loaded('redis')然后我得到一个 true结果。

我一生都无法弄清楚这里发生了什么。为什么 PhpRedisConnector没有看到扩展已加载?

为了完整起见,我还删除了 Redis我的别名 app.php按照 Laravel 文档的指示创建文件。

最佳答案

对于那些使用 composer require predis/predis 安装 Redis 的人,如 Laravel 官方文档中所述。

config/database.php , 改变:

'redis' => [

//'client' => env('REDIS_CLIENT', 'phpredis'),
'client' => env('REDIS_CLIENT', 'predis'),

关于laravel - 尽管加载了扩展程序,但仍出现 'Please make sure the PHP Redis extension is installed and enabled.' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60364869/

49 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com