【问题标题】:memcached igbinary supportmemcached igbinary 支持
【发布时间】:2023-03-25 07:35:01
【问题描述】:

下面是我的 memcached 的 phpinfo() 输出

memcached

memcached support   enabled
Version 2.1.0
libmemcached version    1.0.4
Session support yes
igbinary support    no
json support    no

我正在使用 AWS Linux AMI,我相信它基于 redhat 并使用 YUM。

如何启用 igbinary 支持?

这是否必须在 memcached 安装时发生?我的 memcached 已经在工作了,现在有什么方法可以添加这个支持吗?

谢谢

【问题讨论】:

  • 这更像是一个问题:serverfault.com 这里的用户更喜欢编程,所以你有更好的改变来获得答案。

标签: php linux memcached igbinary


【解决方案1】:

我以前手动编译 memcached 堆栈,其中包括 igbinary。这是在我开始使用 remi repo 之前,它提供了更新的包,没有手动编译的所有开销。

这是我以前手动编译igbinary时使用的笔记:

Had to scp the source from another computer due to lack of direct links, the next steps assume pecl/memcached files are local and extracted
$ -> wget http://pecl.php.net/get/igbinary-1.1.1.tgz
$ -> tar -xzvf igbinary-1.1.1.tgz
$ -> cd igbinary-1.1.1
$ -> phpize
$ -> ./configure # No need for extra config params
$ -> make
$ -> make install # This should copy the resulting .so file to the php dir where all modules are stored
$ -> /etc/init.d/httpd restart # I remember having to do this for phpinfo to reflect the setting correctly after the udpate

现在,如果您查看 phpinfo(或 cli 中的 php -i),则应该将 igbinary 支持设置为 yes。

-- 更新--

确保您在 php.ini 或 igbinary.ini 中有以下行,php 可以读取它:

; Enable igbinary extension module
extension=igbinary.so

-- 更新#2--

忘了提一下,你需要使用以下标志编译 memcached 才能使用 igbinary:

--enable-memcached-igbinary

-- 更新#3--

以防万一将来有人偶然发现。手动维护 PHP 堆栈以及常用的扩展是一件痛苦的事情,而且通常不值得付出额外的努力。你最好使用发行版的包管理器来处理所有繁重的工作,安装 php 和 memcached 并支持 igbinary 的示例如下所示:

yum install php php-cli php-pecl-memcached php-pecl-igbinary

如果您发行版的 php 上游版本较旧,并且您希望使用更新的版本,请查看 REMI 存储库:http://blog.famillecollet.com/pages/Config-en

【讨论】:

  • 谢谢。我做了上面的步骤,一切都安装得很好。我还在 php.ini 中添加了以下内容,我可以在 phpinfo() 中看到有关 igbinary 的更多信息,但问题中的设置仍然是 no...hummmm
  • ;加载 igbinary 扩展 extension=igbinary.so ;使用 igbinary 作为会话序列化器 session.serialize_handler=igbinary ;启用或禁用重复字符串的压缩; # 默认为开。 igbinary.compact_strings=On ;使用 igbinary 作为 APC 缓存中的序列化程序(3.1.7 或更高版本) apc.serializer=igbinary
  • 如果已经安装了 memcached - 我应该删除它并重新安装它以使用标志吗?我可以用 YUM 做到这一点吗?
  • 我问了同样的问题:serverfault.com/questions/395922/…。简短的回答是否定的,您不能通过 Yum 传递自定义编译标志。因此,您将不得不 yum 删除 memcached,下载并手动编译它,这很痛苦。如果你对你的发行版的上游版本的 php 没问题,你可以这样做:yum install php php-cli php-pecl-memcached php-pecl-igbinary,让 yum 处理所有的安装路径和依赖项。如果您需要更新版本的 PHP,请查看 REMI 存储库:blog.famillecollet.com/pages/Config-en
猜你喜欢
  • 1970-01-01
  • 2016-05-14
  • 1970-01-01
  • 2017-04-30
  • 1970-01-01
  • 2023-02-04
  • 1970-01-01
  • 2012-06-11
  • 1970-01-01
相关资源
最近更新 更多