startos安装memcached--亲自测试过

本文详细介绍了在StartOS环境下安装Memcached缓存系统及其PHP客户端的过程,包括解决依赖问题、配置安装路径等关键步骤。

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

一、下载memcached
二、安装memcached
命令:
root@startos:/home/cg/Downloads/memcached/memcached-1.4.16# ./configure --prefix=/home/cg/Apps/memcached --with-libevent=/usr/lib/libevent.so

输出信息的最后部分:
checking for libevent directory... configure: error: libevent is required.  You can get it from http://www.monkey.org/~provos/libevent/
      If it's already installed, specify its path using --with-libevent=/dir/

命令:
root@startos:/home/cg/Downloads/memcached/memcached-1.4.16# ./configure --prefix=/home/cg/Apps/memcached --with-libevent=/usr/lib/libevent-2.0.so.5

输出信息同上。
如何解决这个问题?
三、重新安装libevent(一定不能删除系统默认的libevent,曾经因为删除了它导致系统终端命令不能运行,最后崩溃)
1.下载libevent
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
命令:
root@startos:/home/cg/Downloads/libevent/libevent-2.0.21-stable# ./configure --prefix=/home/cg/Apps/memcached/libevent
root@startos:/home/cg/Downloads/libevent/libevent-2.0.21-stable# make;make install
失败。
从startos的源码包下载了libevent-dev
http://pkg.startos.org/packages/l/libevent-dev/libevent-dev_2.0.10-i686.ypk
然后用ypkg --install filename默认安装之后,再次执行命令:
root@startos:/home/cg/Downloads/memcached/memcached-1.4.16# ./configure --prefix=/home/cg/Apps/memcached --with-libevent=/usr/lib/
好像成功了。(很关键的步骤。若换成其他方式,能否直接下载libevent-dev然后安装。以后再试。)
make;make install
root@startos:/home/cg/Apps/memcached/bin# ./memcached -d -m 128 -u root -p 11211
没有任何输出信息,如何知道memcached是否启动了?
四、安装memchached客户端
1.下载PHP的memcached客户端
命令:
root@startos:/home/cg/Downloads/php# wget http://pecl.php.net/get/memcache-3.0.8.tgz
2.安装PHP的memcached客户端
命令:
root@startos:/home/cg/Downloads/php# tar -xzvf memcache-3.0.8.tgz
​命令:
root@startos:/home/cg/Downloads/php/memcache-3.0.8# /home/cg/Apps/LAMP/php/php/bin/phpize
输出信息:
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
执行上面的命令后,在memcache下生成了configure文件。
命令:
root@startos:/home/cg/Downloads/php/memcache-3.0.8# ./configure --enable-memcache --with-php-config=/home/cg/Apps/LAMP/php/php/bin/php-config --with-zlib-dir
不明白这条命令中的--with-zlib-dir的作用是什么。
输出信息的最后部分:
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
没有报错,应该是成功了。
命令:
make;make install
输出信息的最后部分:
Installing shared extensions:     /home/cg/Apps/LAMP/php/php/lib/php/extensions/no-debug-zts-20121212/
3.修改PHP的配置文件php.ini,在其中的Dynamic Extensions部分加入
extension = /home/cg/Apps/LAMP/php/php/lib/php/extensions/no-debug-zts-20121212/memcache.so​
4.重启apache,查看phpinfo.php的输出信息,增加了


memcache

memcache support enabled
Version 3.0.8
Revision $Revision: 329835 $
说明PHP的memcache客户端安装成功了!​










评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值