AMH 社区首页
AMH社区 - 开放自由有价值的社区
[求助帖] 编译安装memcache的方法 |
|
---|---|
pc10201 |
pc10201 发表于 2013-07-12 11:21:14
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar zxvf memcache-2.2.7.tgz cd memcache-2.2.7 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make make install 显示如下信息时为安装成功: Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/ nano /etc/php.ini 在最后加上下面的代码 extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/" extension = "memcache.so" 保存 killall php-fpm /usr/local/php/sbin/php-fpm 启动 查看phpinfo中是否有memcache一项,有则成功 ========================================================================= 安装memcached的方法(需首先安装libevent) 没有livevent可 yum install libevent-devel wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz tar -zxvf memcached-1.4.15.tar.gz cd memcached-1.4.15 ./configure --prefix=/usr/local/memcached --with-libevent=/usr/ make make install 启动memcached服务, 这里分配32M内容,端口为11211 /usr/local/memcached/bin/memcached -d -m 32 -l 127.0.0.1 -p 11211 -u root -P /tmp/memcached.pid 无提示则启动成功 运行下面的php文件(记得要加执行权限),如果有输出This is a test!,就表示环境搭建成功。开始领略Memcache的魅力把! <?php $mem = new Memcache; $mem->connect("127.0.0.1", 11211); $mem->set('key', 'This is a test!', 0, 60); $val = $mem->get('key'); echo $val; ?>
点赞,加油! (2分)
2013-07-12 11:21:14 1
|
恶小弟 |
路过学习一下
回复
2013-07-12 11:22:29 2
|
amysql |
都差不多 : )
http://amysql.com/bbs/forum.php?mod=viewthread&tid=489 http://amysql.com/bbs/forum.php?mod=viewthread&tid=376
回复
2013-07-12 14:17:41 3
AMH面板 - 好用高效低占用、安全可靠极稳定 |