Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable igbinary with memcached installed first

I have memcached installed with libmemcached. Also I have installed igbinary.

This is my 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

.

When I run phpinfo() i see that igbinary is enabled, but not for 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

Phpinfo() about memcached:

memcached
memcached support   enabled
Version     1.0.2
libmemcached version    0.51
Session support     yes
igbinary support    no 

That last line: igbinary support thats the question. Oddly enough, as you can see under the heading apc there is stated: Serialization Support php, igbinary.

So do someone know why I cannot enable igbinary for memcached?

Thanks!

like image 345
DelphiLynx Avatar asked Jul 26 '11 12:07

DelphiLynx


People also ask

What is Igbinary?

Igbinary is a drop in replacement for the standard php serializer. Instead of. the time and space consuming textual representation used by PHP's serialize(), igbinary stores php data. structures in a compact binary form.


1 Answers

You can't enable it because PECL memcached was not built with '--enable-memcached-igbinary'

PECL install does not take this as a flag, so here is how you can build pecl memcached with it (following example is on ubuntu as 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

Load up a phpinfo() page and you should now see 'igbinary support: yes' under memcached section.

like image 106
rynop Avatar answered Sep 30 '22 18:09

rynop