: jank : : 5625 : 2016-08-09 00:52 php
安装memcache之前首先要安装好libevent(libevent是一个事件触发的网络库,适用于windows、linux、bsd等多种平台,内部使用select、epoll、kqueue、IOCP等系统调用管理事件机制。著名分布式缓存软件memcached也是基于libevent,而且libevent在使用上可以做到跨平台,而且根据libevent官方网站上公布的数据统计,似乎也有着非凡的性能。)
2. 下载libevent:http://libevent.org/
解压下载好的 libevent-2.0.8-rc.tar.gz 压缩包
tar zxvf libevent-2.0.8-rc.tar.gz
cd libevent-2.0.8
安装:
./configure --prefix=/usr/local/libevent
make && make install
3. 下载memcache
解压下载好的 memcached-1.4.29.tar.gz 压缩包
tarzxvf memcached-1.4.29.tar.gz
cd memcached-1.4.29
安装: ./configure --prefix=/usr/local/memcache --with-libevent=/usr/local/libevent
make && make install
4. 下载memcache扩展
这里特别注意不知道是不是因为php7版本的原因还是怎样pecl官网下载的memcache扩展怎样都编译不了
于是在网上找到一个下载memcache扩展的链接:
https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
把下载好的软件包在windows下解压好通过ftp传输工具传到服务器。
进入memcache扩展文件夹:cd pecl-memcache
/usr/local/php7/bin/phpize 生成configure等编译文件
编译:./configure --with-php-config=/usr/local/php7/bin/php-config
安装:make && make install
修改php.ini文件
vim /usr/local/php7/etc/php.ini
添加:extension = memcache.so
5.重启php
pkill -9 php
/usr/local/php7/sbin/php-fpm
打开phpinfo显示有memcache信息说明已经安装成功了。