ubuntu在xampp下安裝memcache擴展

sudo wget http://pecl.php.net/get/memcache-2.2.1.tgzphp

sudo tar vxzf memcache-2.2.1.tgz服務器

cd memcache-2.2.1/cookie

sudo /opt/lampp/bin/phpizesession

./configure --with-php-config=/opt/lampp/bin/php-config --enable-memcacheyii

#makeui

#make installspa

(會顯示編譯好了memcache.so,並安裝到了.net

         Build complete.debug

         Don't forget to run 'make test'.server

         root@hdp003:/home/cchunDownload/memcache-2.2.1# make install

         Installing shared extensions:     /opt/lampp/lib/php/extensions/no-debug-non-zts-20121212/

 

若是顯示錯誤:

cd /usr/src/

sudo wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz

sudo tar -zxvf m4-1.4.9.tar.gz

cd m4-1.4.9/

./configure  && make && make install

 

 wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz

 # tar -zvxf autoconf-2.62.tar.gz
 # cd autoconf-2.62/
 # ./configure && make && make install

 

若是顯示缺乏zlib則:

sudo apt-get install zlib1g-dev

 

配置php.ini 擴展memcache.so便可使用(固然,首先還得有memcache服務器,memcache服務器的安裝與啓動請直接百度)。

 

 

配置yii使用memcache使用:

 'mcache'=>array(
                        'class'=>'system.caching.CMemCache',
                        'servers'=>array(
                                array(
                                        'host'=>'192.168.1.202',
                                        'port'=>11211
                                ),
                        ),
                ),

                 'session' => array (
                       'class'=> 'CCacheHttpSession',
                        'cookieMode' => 'only',
                        'cacheID'=>'mcache',
                        'timeout' => 1200
                 ),
相關文章
相關標籤/搜索