2011-07-26 24 views
10

我有memcached與libmemcached安裝。我也安裝了igbinary如何啓用與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 

phpinfo()函數有關的memcached:

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

所以有人知道爲什麼我不能啓用igbinary爲memcached

謝謝!

+0

你選擇的答案是如何幫助你的?我處於同樣的情況,但無法理解答案的意義。你能解釋你做了什麼嗎? – 2013-05-09 09:57:25

回答

9

您可以檢查的Memcached :: HAVE_IGBINARY不變,看看你的memcached擴展使用--enable-memcached的-igbinary編譯。

來源:http://php.net/manual/en/memcached.constants.php

的Memcached :: OPT_SERIALIZER

指定用於序列化非標量值串行。 有效的序列化器是Memcached :: SERIALIZER_PHP或 Memcached :: SERIALIZER_IGBINARY。只有當 memcached配置了--enable-memcached-igbinary選項並且 加載了igbinary擴展時才支持後者。

類型:整型,默認值:Memcached :: SERIALIZER_PHP。

的Memcached :: HAVE_IGBINARY

表示igbinary串行支持是否是可用。

類型:布爾值。

+0

我必須更好地解讀我認爲的手冊。謝謝! – DelphiLynx

+0

我想問題是,如果memcached沒有使用enabled-memcached-igbinary編譯,如何更改設置?或者我們是否必須重新安裝memcached? – 2013-05-09 10:00:21

1

如果您在Mac上工作,使用的MacPorts,您可以安裝PHP5-memcached的擴展與此命令igbinary支持:

sudo port install php5-memcached +igbinary 

+igbinary指定php5-memcached端口的變體。

該命令將在Mac上安裝啓用了igbinary的memcached擴展。

你可以閱讀更多有關端口變種在這裏:http://guide.macports.org/#using.variants

11

您不能啓用,因爲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()函數頁面,你現在應該可以看到「igbinary支持:是」下memcached部分。

+0

謝謝@rynop !!!!!!!另一個網站沒有工作,但你的指示爲我做了竅門。巨大的幫助。 – hourback

+0

np。太糟糕了,它沒有被記錄得更好,因爲它非常強大。 – rynop

+0

像在Ubuntu 12.04中的魅力一樣工作 - 謝謝!精確的圖像嘗試是來自puphpet(http://box.puphpet.com/ubuntu-precise12042-x64-vbox43.box) –