nasdaqhe's blog

被生活强jian着
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

ubuntu+php5-fpm 下安装 memcached PHP扩展

Posted on 2011-05-15 23:44  nasdaqhe  阅读(344)  评论(0编辑  收藏  举报

 1.获取编译工具下面要用来编译源代码,如果已经安装可跳过这步
  [bash] sudo apt-get install build-essential [/bash]
 
 2.安装PEAR and memcached
  [bash] sudo apt-get install php-pear memcached [/bash]
 
 3.编译libmemcached
  到 https://launchpad.net/libmemcached/+download 下载最新的libmemcached源代码,解压编译安装步骤如下:
  Extract the files with your preferred method, or type:
  [bash] tar -xzf libmemcached-0.37.tar.gz [/bash]
  Move into the extracted directory:
  [bash] cd libmemcached-0.37/ [/bash]
  Configure the package.
  [bash] ./configure –with-memcached [/bash]
  Make.
  [bash] make [/bash]
  Make install. Note this probably will require sudo rights.
  [bash] sudo make install [/bash]
 
 4.PECL
  [bash] sudo pecl install memcached [/bash]
  When this process completed, you should see something like this:
  [bash]
  Build process completed successfully
  Installing ‘/usr/lib/php5/20060613+lfs/memcached.so’
  install ok: channel://pecl.php.net/memcached-1.0.0
  Extension memcached enabled in php.ini
  [/bash]

 

 5.修改PHP.INI添加扩展
  [bash] sudo vi /etc/php5/fpm/php.ini [/bash] 
  在php.ini 中添加“extension = memcached.so”
  重启PHP-FPM服务
  [bash] sudo service php5-fpm restart [/bash]