memcached安装

xiaoxiao2021-02-28  88

一. 安装服务器端memcached

1.首先先安装memcached依赖库libevent。

安装libevent [官方网站] http://libevent.org/ wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz tar -zxvf libevent-2.0.22-stable.tar.gz cd libevent-2.0.22-stable ./configure --prefix=/package/libevent make make install

2.安装memcached

[官方网站] http://memcached.org/ wget http://memcached.org/files/memcached-1.4.25.tar.gz tar -zxvf memcached-1.4.25.tar.gz cd memcached-1.4.25 ./configure --prefix=/lnmp/memcached --with-libevent=/package/libevent make make install

通过以上操作就很简单的把memcached服务端编译好了。这时候就可以打开服务端进行工作了。

/lnmp/memcached/bin/memcached -d -m 2048 -l 127.0.0.1 -p 11211 -u root -c 1024 –P /tmp/memcached.pid

启动参数说明:

-d  选项是启动一个守护进程。 -m  分配给Memcache使用的内存数量,单位是MB,默认64MB。 -l  监听的IP地址。(默认:INADDR_ANY,所有地址) -p  设置Memcache的TCP监听的端口,最好是1024以上的端口。 -u  运行Memcache的用户,如果当前为root的话,需要使用此参数指定用户。 -c  选项是最大运行的并发连接数,默认是1024。 -P  设置保存Memcache的pid文件。

二. memcached(客户端篇)

linux 生成php的扩展库文件memcached.so windows 需要加载memcached.dll memcached安装教程 http://www.cnblogs.com/project/p/5136727.html http://blog.csdn.net/sinat_21125451/article/details/50983343 linux安装php memcached扩展教程 http://blog.csdn.net/white__cat/article/details/27674467 http://www.linuxidc.com/Linux/2016-05/131690.htm

安装libmemcached

./configure --prefix=/apps/svr/libmemcached --with-memcached

安装libmemcached gcc版本过低问题

https://zhangge.net/5119.html yum install gcc-c++

安装memcached php客户端 获取.so文件

报错:error: no, sasl.h is not available. Run configure with –disable-memcached-sasl to disable this check ./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/lib/libmemcached --disable-memcached-sasl

配置php.ini扩展 重启php-fpm

转载请注明原文地址: https://www.6miu.com/read-41013.html

最新回复(0)