1.先要安裝igbinary.
igbinary在序列化和反序列化的效率要比PHP自帶的高
wget https://nodeload.github.com/p…
phpize
./configure CFLAGS=”-O2 -g” –enable-igbinary
make
make install
修改php.ini,新增
Load igbinary extension
extension=igbinary.so
Use igbinary as session serializer
session.serialize_handler=igbinary
接下來安裝php-redis
wget https://github.com/nicolasff/…
mv 2.2.4.tar.gz /usr/local/src/
cd /usr/local/src/
tar zxvf 2.2.4.tar.gz
cd phpredis-2.2.4/
phpize
./configure –enable-redis-igbinary#貌似(./configure –enable-redis-igbinary –with-php-config=/usr/bin/php-config)這樣也可以
make
make install
這樣就安裝完成了
這樣以後在例項化reids的時候加一句
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);
就ok了