memcached缓存session
RedHat5.9
libevent-1.4.13-stable.tar.gz
memcached-1.4.20.tar.gz
memcache-3.0.8.tgz
安装:
tar
xf libevent-2.0.21-stable.
tar
.gz
cd
libevent-2.0.21-stable
.
/configure
--prefix=
/usr/local/libevent
make
&&
make
install
echo
"/usr/local/libevent/lib"
>
/etc/ld
.so.conf.d
/libevent
.conf
ldconfig
tar
xf memcached-1.4.17.
tar
.gz
cd
memcached-1.4.17
.
/configure
--prefix=
/usr/local/memcached
--with-libevent=
/usr/local/libevent
make
&&
make
install
tar zxvf memcache-3.0.8.tgz
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcache
生成库文件后,配置到/etc/php.ini中
extentsion = <DIR>
重启php-fpm即可。
#####################################################################
memcached的启动脚本:
#!/bin/bash
#
# Init file for memcached
#
# chkconfig: - 86 14
# description: Distributed memory caching daemon
#
# processname: memcached
# config: /etc/sysconfig/memcached
.
/etc/rc
.d
/init
.d
/functions
## Default variables
PORT=
"11211"
USER=
"nobody"
MAXCONN=
"1024"
CACHESIZE=
"64"
OPTIONS=
""
RETVAL=0
prog=
"/usr/local/memcached/bin/memcached"
desc=
"Distributed memory caching"
lockfile=
"/var/lock/subsys/memcached"
start() {
echo
-n $
"Starting $desc (memcached): "
daemon $prog -d -p $PORT -u $USER -c $MAXCONN -m $CACHESIZE
"$OPTIONS"
RETVAL=$?
echo
[ $RETVAL -
eq
0 ] &&
touch
$lockfile
return
$RETVAL
}
stop() {
echo
-n $
"Shutting down $desc (memcached): "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -
eq
0 ] &&
rm
-f $lockfile
return
$RETVAL
}
restart() {
stop
start
}
reload() {
echo
-n $
"Reloading $desc ($prog): "
killproc $prog -HUP
RETVAL=$?
echo
return
$RETVAL
}
case
"$1"
in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
[ -e $lockfile ] && restart
RETVAL=$?
;;
reload)
reload
;;
status)
status $prog
RETVAL=$?
;;
*)
echo
$
"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
esac
exit
$RETVAL
###############################################################
memcached的测试部分:待续
本文出自 “常用文档” 博客,请务必保留此出处http://yujianglei.blog.51cto.com/7215578/1565575
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。