警告:Memcached :: getMulti():无法反序列化值,没有二进制支持 [英] Warning: Memcached::getMulti(): could not unserialize value, no igbinary support

查看:235
本文介绍了警告:Memcached :: getMulti():无法反序列化值,没有二进制支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月来,我已经在我的Drupal网站上成功使用了memcached(通过OS X上的brew安装).

I'm using memcached (installed via brew on OS X) on my Drupal site successfully for already few months.

但是,很长的页面加载时间之后,此错误开始突然出现:

However this error start happening out of blue after very long page load:

(!)警告:Memcached :: getMulti():无法反序列化值,第375行的sites/all/modules/contrib/memcache/dmemcache.inc中没有二进制支持

( ! ) Warning: Memcached::getMulti(): could not unserialize value, no igbinary support in sites/all/modules/contrib/memcache/dmemcache.inc on line 375

为什么会这样,为什么我需要igbinary(我认为我拥有)以及如何解决它?

Why this is happening, why do I need igbinary (which I think I have) and how to fix it?

似乎我已经安​​装了php56-igbinary.

It seems I've already php56-igbinary installed.

$ php -i | grep igbinary
Additional .ini files parsed => /usr/local/etc/php/5.6/conf.d/ext-igbinary.ini,
igbinary
igbinary support => enabled
igbinary version => 1.2.1
igbinary APC serializer ABI => no
igbinary session support => yes
igbinary.compact_strings => On => On
igbinary support => yes
memcached.serializer => igbinary => igbinary
Registered serializer handlers => php_serialize php php_binary wddx igbinary 

推荐答案

Igbinary替代了标准

Igbinary is a replacement for the standard PHP serializer which normally consuming a lot of time and space storing the data in textual representation. With support for that extension, savings are significant when using memcached or similar memory based storages (e.g. Redis), because all PHP data structures are stored in a compact binary form.

我所解决的问题发生了,因为有两个PHP版本,其中一个从CLI中使用,具有igbinary支持(例如,由drush使用),而另一个由Apache/MAMP使用,而没有igbinary:

The problem which I dealt it happened, because there were two PHP versions, one used from CLI which had igbinary support (e.g. used by drush) and another one used by Apache/MAMP didn't have igbinary:

$ /Applications/MAMP/bin/php/php5.6.10/bin/php -i | grep igbinary
igbinary support => no

因此由于某些原因,某些对象是使用带有igbinary的PHP缓存的,因此在没有该支持的情况下,PHP无法将其反序列化.

So for some reason some objects were cached using PHP with igbinary, then it failed to be unserialized by PHP without that support.

MAMP似乎不为其PHP捆绑包提供烟灰缸支持,因此解决方案包括:

It seems MAMP doesn't provide igbinary support for their PHP bundle, therefore the solutions include:

  • 扩展名需要手动编译并加载到MAMP(--enable-memcached-igbinary)中,
  • 在PHP CLI中禁用igbinary(不推荐),因此它不会与Apache冲突,
  • 继续重启memcached,例如brew services restart memcached(OS X)
  • 使用支持igbinary的PHP内置服务器代替,例如:php -S localhost:8888
  • extension needs to be compiled manually and loaded into MAMP (--enable-memcached-igbinary),
  • disable igbinary in PHP CLI (not recommended), so it won't conflict with Apache,
  • keep restarting memcached, e.g. brew services restart memcached (OS X)
  • use PHP builtin server instead which has support for igbinary, like: php -S localhost:8888

这篇关于警告:Memcached :: getMulti():无法反序列化值,没有二进制支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆