码迷,mamicode.com
首页 > Web开发 > 详细

安装memcached服务器和PHP中添加memcache拓展模块

时间:2016-06-24 20:26:24      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:

Memcached是一个高性能的分布式内存对象缓存系统,用于动态web应用以减轻数据库的负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提拱动态 数据驱动网站的速度。

memcached是其于libevent做事件触发的,首先装libevent.

wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz

 

[root@14LN src]# tar -xzvf libevent-2.0.21-stable.tar.gz 
[root@14LN libevent-2.0.21-stable]# pwd
/usr/local/src/libevent-2.0.21-stable
[root@14LN libevent-2.0.21-stable]# ./configure --prefix=/usr/local/libevent
[root@14LN libevent-2.0.21-stable]# make && make install

 接下来安装Memcached:

[root@14LN src]# wget http://pkgs.fedoraproject.org/lookaside/pkgs/memcached/memcached-1.4.15.tar.gz/36ea966f5a29655be1746bf4949f7f69/memcached-1.4.15.tar.gz

 

[root@14LN src]# tar -xzvf memcached-1.4.15.tar.gz 
[root@14LN src]# cd memcached-1.4.15
[root@14LN memcached-1.4.15]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
[root@14LN memcached-1.4.15]# make && make install
安装php扩展模块memcache
[root@14LN src]# wget http://pecl.php.net/get/memcache-2.2.6.tgz
[root@14LN src]# cd memcache-2.2.6
[root@14LN memcache-2.2.6]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
[root@14LN memcache-2.2.6]# ./configure --enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir
[root@14LN memcache-2.2.6]# make && make install



安装成功会有类似下面的提示: Build complete.
Don‘t forget to run ‘make test‘.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/

[root@14LN memcache-2.2.6]# egrep ‘memcache|extension_dir‘ /etc/php.ini
[memcache]
extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/"
extension=memcache.so
; extension_dir = "./"
; extension_dir = "ext"
; Be sure to appropriately set the extension_dir directive.
;sqlite3.extension_dir =

 

启动memcache
[root@14LN memcache-2.2.6]# /usr/local/memcached/bin/memcached -d -u root -m 63 -p 11211 -c 10240

 

[root@14LN memcache-2.2.6]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm  done

技术分享 

安装memcached服务器和PHP中添加memcache拓展模块

标签:

原文地址:http://www.cnblogs.com/bass6/p/5615195.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!