标签:src 提示 nobody linu memcache 包括 comm make disable
memcached的安装包括:1、服务端的安装;2、客户端的安装
一、服务器端安装
方法一:
memcached 依赖于libevent 库,因此我们需要先安装libevent.
假设将源码放在/usr/local/src
1 cd /usr/local/src
2 wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
3 tar zxvf libevent-2.0.22-stable.tar.gz
4 cd libevent-2.0.22-stable
5 ./configure --prefix=/usr/local/libevent
6 make && make install
安装memcached服务器版
1 cd /usr/local/src
2 wget http://www.memcached.org/files/memcached-1.4.33.tar.gz
3 tar zxvf memcached-1.4.33.tar.gz
4 cd memcached-1.4.33
5 ./configure --prefix=/usr/local/memcached 6 --with-libevent=/usr/loca/libevent
7 make && make install
启动memcached
1 /usr/local/memcached/bin/memcached -m 64 -p 11211 -u nobody -vv
显示如上说明memcached服务器端安装启动成功并把信息输出到控制台
想后台运行加-d选项
1 /usr/local/memcached/bin/memcached -m 64 -p 11211 -u nobody -d
1 ps aux | grep memcached
查询进程是否有memcached
启动成功
方法二:
1 yum -y install memcached
就这一步我们就安装完了
启动memcached
1 /usr/bin/memcached -l 127.0.0.1 -p 11211 -m 150 -u root
显示如方法二启动结果
二、客户端安装
客户端需安装libmemcached库
1 cd /usr/local/src
2 wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
3 tar zxvf libmemcached-1.0.18.tar.gz
4 cd libmemcached-1.0.18
5 ./configure --prefix=/usr/local/libmemcached
6 make && make install
安装php-fpm的memcached扩展
1 cd /usr/local/src
2 wget http://pecl.php.net/get/memcached-2.2.0.tgz
3 tar zxvf memcached-2.2.0.tgz
4 cd memcached-2.2.0
到了这一步,我们要使用安装php时生成的 phpize 来生成 configure 配置文件
1 /usr/local/php/bin/phpize 2 --with-php-config=/usr/local/php/bin/php-config
3 ./configure --with-php-config=/usr/local/php/bin/php-config 4 --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-sasl
5 make && make install
--with-php-config 指定 php-config,该文件与 phpize 所在目录相同,
--with-libmemcached-dir 指定 libmemcached 安装目录,就刚才我们 --prefix 那个目录 ,
--disable-memcached-sasl 说明我们系统不支持sasl.h
如果安装成功,会提示:Installing shared extension:/usr/local/php/lib/extensions/no-debug-non-zts-20160524/ 等类信息
接下来,我们编辑php配置文件php.ini,把 php-memcached 扩展加到配置文件。
在 php.ini 中添加以下内容:
1 extension=memcached.so
最后重启nginx和php-fpm
标签:src 提示 nobody linu memcache 包括 comm make disable
原文地址:http://www.cnblogs.com/wuwenshuai/p/6408305.html