安装Memcached

本文介绍了如何在Linux环境中安装Memcached及其PHP-memcached扩展。首先,需要确保安装了必要的依赖,接着进行Memcached的安装,并检查libevent文件夹是否存在。然后,详细说明了在Linux下安装PHP-memcached扩展的步骤,最后提供了启用PHP扩展模块的方法链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装Memcached

安装memcached之前需要安装libevent依赖

shell> cd /root/amp
shell> wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz
shell>tar -zxvf libevent-2.1.11-stable.tar.gz
shell>cd libevent-2.1.11-stable
shell>./configure --prefix=/usr/local/libevent && make && make install

查看是否安装成功需要看编译过程有没有error,还有就是查看/root/amp/下有没有libevent 文件夹

安装Memcached

shell> cd /root/amp
shell> wget http://www.memcached.org/files/memcached-1.5.16.tar.gz
shell> tar -zxvf memcached-1.5.16.tar.gz
shell> cd memcached-1.5.16
shell> ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent && make && make install

安装PHP—memcached扩展

Linux下

cd /root/amp/
wget http://pecl.php.net/get/memcached-3.1.3.tgz
tar -zxvf memcached-3.1.3.tgz 
cd memcached-3.1.3
/usr/bin/phpize 
./configure --with-php-config=/usr/bin/php-config 
#报错
#checking for zlib location... configure: error: memcached support requires ZLIB. Use --with-zlib-dir=<DIR> to specify the prefix where ZLIB headers and library are located
#需要安装zlib-devel
yum install zlib-devel

#configure: error: memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located
#这是因为需要安装libmemcached-devel
yum install libmemcached-devel

./configure --with-php-config=/usr/bin/php-config
make && make install

启用扩展模块请看https://blog.youkuaiyun.com/github_39437588/article/details/90023951

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值