1. 程式人生 > >linux安裝memcached安裝以及memcache的php擴充套件

linux安裝memcached安裝以及memcache的php擴充套件

1.分別把memcached和libevent下載回來,放到自己下載的目錄下:

# wget http://www.danga.com/memcached/dist/memcached-1.2.5.tar.gz
# wget http://www.monkey.org/~provos/libevent-1.2.tar.gz

2.先安裝libevent:
# tar zxvf libevent-1.2.tar.gz
# cd libevent-1.2
# ./configure -prefix=/usr      #這是安裝到的目錄
# make
# make install
3.測試libevent是否安裝成功:
# ls -al /usr/lib | grep libevent
4.安裝memcached,同時需要安裝中指定libevent的安裝位置:
# tar zxvf memcached-1.2.0.tar.gz
# cd memcached-1.2.0
# ./configure -with-libevent=/usr     #這是安裝到的目錄
# make
# make install
安裝完成後會把memcached放到 /usr/local/bin/memcached ,

5.測試是否成功安裝memcached:

ls -al /usr/local/bin/memcached

--------------------------------------------------------------------------------------------------------------------------------

安裝Memcache的PHP擴充套件

2.下載到指定的目錄並進行解壓然後進入解壓後的目錄

3.用phpize生成configure配置檔案

/phpstudy/server/php/bin/phpize

4.再用 php-config 進行配置。然後編譯、安裝
./configure -enable-memcache --with-php-config=/phpstudy/server/php/bin/php-config --with-zlib-dir
make     編譯
make install   安裝
5..上述安裝完後會有類似這樣的提示:
/phpstudy/server/php/lib/php/extensions/no-debug-non-zts-20121212/
6.把php.ini中的extension_dir = “./”修改為
extension_dir = “/phpstudy/server/php/lib/php/extensions/no-debug-non-zts-20121212/”
7..新增一行來載入memcache擴充套件:
extension=memcache.so