通过 PECL 安装的 Redis PHP 扩展可以在 Mac M1 上运行吗?

发布于 2025-01-09 11:30:13 字数 1301 浏览 1 评论 0原文

Redis 服务器已使用 Homebrew 和 brew services start redis 成功运行。 PECL Redis 安装程序似乎可以与 sudo pecl install redis 配合使用,给出以下输出:

Build process completed successfully
Installing '/opt/homebrew/Cellar/[email protected]/7.4.28/pecl/20190902/redis.so'
install ok: channel://pecl.php.net/redis-5.3.7
Extension redis enabled in php.ini

如果我使用 php --ini ,这就是输出:

Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /opt/homebrew/lib/php/pecl/20190902/redis.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/redis.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/redis.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/redis.so' (no such file), '/usr/lib/redis.so' (no such file)), /opt/homebrew/lib/php/pecl/20190902/redis.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/redis.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/redis.so.so' (no such file), '/usr/local/lib/redis.so.so' (no such file), '/usr/lib/redis.so.so' (no such file))) in Unknown on line 0

The redis.so 库位于 /opt/homebrew/lib/php/pecl/20190902 中。

有什么方法可以让这个库在 Mac M1 上运行吗?

The Redis server is running successfully using Homebrew with brew services start redis.
The PECL Redis installer appears to work with sudo pecl install redis, giving the following output:

Build process completed successfully
Installing '/opt/homebrew/Cellar/[email protected]/7.4.28/pecl/20190902/redis.so'
install ok: channel://pecl.php.net/redis-5.3.7
Extension redis enabled in php.ini

If I use php --ini, this is the output:

Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /opt/homebrew/lib/php/pecl/20190902/redis.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/redis.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/redis.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/redis.so' (no such file), '/usr/lib/redis.so' (no such file)), /opt/homebrew/lib/php/pecl/20190902/redis.so.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/redis.so.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/redis.so.so' (no such file), '/usr/local/lib/redis.so.so' (no such file), '/usr/lib/redis.so.so' (no such file))) in Unknown on line 0

The redis.so library is in /opt/homebrew/lib/php/pecl/20190902.

Is there any way to get this library working on Mac M1?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不语却知心 2025-01-16 11:30:13

您可以使用 arch 运行 pecl 以确保架构为 arm64

arch -arm64 sudo pecl install redis

或者,您可以使用我维护的酿造水龙头(shivammathur/extensions)。

brew tap shivammathur/extensions
brew install [email protected]

You can run pecl with arch to ensure that the architecture is arm64.

arch -arm64 sudo pecl install redis

Alternatively, you can use a brew tap I maintain (shivammathur/extensions).

brew tap shivammathur/extensions
brew install [email protected]
り繁华旳梦境 2025-01-16 11:30:13

我已经做了同样的事情,就像接受的答案

arch -arm64 sudo pecl install redis

但这并没有立即对我起作用。我需要重新安装redis。

pecl卸载redis

pecl安装redis

I have done the same like accepted answer

arch -arm64 sudo pecl install redis

But that didn't work for me immediately. I needed to reinstall redis.

pecl uninstall redis

pecl install redis

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文