我已经用libmemcached安装了memcached。我还安装了igbinary。
这是我的php.ini:
; Directory in which the loadable extensions (modules) reside.
;extension_dir = "./"
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"
extension=apc.so
apc.enabled=1
apc.shm_size=128M
extension=memcached.so
session.save_handler=memcached
session.save_path="127.0.0.1:11211"
extension=igbinary.so
session.serialize_handler=igbinary
igbinary.compact_strings=On。
当我运行phpinfo()时,我看到启用了igbinary,但是memcached的不是:
apc
Serialization Support php, igbinary
igbinary
igbinary support enabled
igbinary version 1.1.1
igbinary APC serializer ABI 0
Directive Local Value Master Value
igbinary.compact_strings On On关于memcached的Phpinfo():
memcached
memcached support enabled
Version 1.0.2
libmemcached version 0.51
Session support yes
igbinary support no 最后一行:igbinary support,这是问题所在。奇怪的是,正如您在apc标题下看到的,有这样的声明:Serialization Support php, igbinary。
那么,有人知道为什么我不能为memcached启用ig二进制吗?
谢谢!
发布于 2011-07-26 14:03:44
您可以检查Memcached::HAVE_IGBINARY常量,以确定您的memcached扩展是否使用--启用-memcached-igbinary编译。
来源:http://php.net/manual/en/memcached.constants.php
Memcached::OPT_SERIALIZER
指定用于序列化非标量值的序列化程序。有效的序列化器是Memcached::SERIALIZER_PHP或Memcached::SERIALIZER_IGBINARY。只有当memcached配置了--启用-memcached-ig二进制选项并加载了ig二进制扩展时,才支持后者。 类型:整数,默认值: Memcached::SERIALIZER_PHP。
Memcached::HAVE_IGBINARY
指示是否可以使用ig二进制序列化程序支持。 类型:布尔型。
发布于 2012-12-26 17:18:00
您无法启用它,因为PECL memcached不是用“-- enable -memcached-igbinary”构建的
PECL安装不把它当作标志,所以下面是如何使用它构建pecl memcached (下面的示例是在ubuntu上作为root)
#if you have libmemcached-dev < 1.0.X need to run: sudo apt-get purge libmemcached-dev
apt-get install libevent-dev
pecl install igbinary
#cant do sudo pecl install memcached-2.1.0 cuz it wont let me use igbinary
#compiling manually per http://www.neanderthal-technology.com/2011/11/ubuntu-10-install-php-memcached-with-igbinary-support/
#install libmemcached v 1.0.X for pecl memcached 2.1.0
cd /tmp
libmemcached_ver="1.0.15"
wget https://launchpad.net/libmemcached/1.0/${libmemcached_ver}/+download/libmemcached-${libmemcached_ver}.tar.gz
tar xzvf libmemcached-${libmemcached_ver}.tar.gz
cd libmemcached-${libmemcached_ver}/
./configure
make
make install
cd ../
rm -r libmemcached-${libmemcached_ver}
#install memcached PECL extension
pecl_memcached_ver="2.1.0"
pecl download memcached-${pecl_memcached_ver}
tar xzvf memcached-${pecl_memcached_ver}.tgz
cd memcached-${pecl_memcached_ver}/
phpize
./configure --enable-memcached-igbinary
make
make install
cd ..
rm -r memcached-${pecl_memcached_ver}
echo "extension=igbinary.so" > /etc/php5/fpm/conf.d/igbinary.ini
echo "extension=memcached.so" > /etc/php5/fpm/conf.d/memcached.ini
#now restart your PHP server加载phpinfo()页面,您现在应该可以在memcached部分中看到'igbinary : yes‘。
发布于 2011-12-14 14:32:14
如果您在Mac上工作并使用MacPorts,您可以使用以下命令安装php5-memcached扩展,并提供igbinary:
sudo port install php5-memcached +igbinary+igbinary指定php5-memcached端口的变体。
该命令将在Mac上安装一个启用ig二进制的memcached扩展。
您可以在这里阅读更多关于端口变体的内容:http://guide.macports.org/#using.variants
https://stackoverflow.com/questions/6830260
复制相似问题