yii2 下使用memcached

http://www.yiichina.com/topic/6636

首先先安装memcached依赖库libevent

cd /  

wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz  

tar -zxvf libevent-2.1.8-stable.tar.gz  

cd libevent-2.1.8-stable  

./configure --prefix=/usr/local/libevent  

make && make install

安装memcached(服务端篇)

cd /  
wget www.memcached.org/files/memcached-1.5.3.tar.gz  
tar -zxvf memcached-1.5.3.tar.gz  
cd memcached-1.5.3  
./configure --prefix=/usr/local/libmemcached --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libevent=/usr/local/libevent  
make && make install

启动服务

cd /usr/local/libmemcached/bin
./memcached  #或者使用./memcached -u root

测试连接

#memcached默认使用11211端口
telnet 192.168.1.229 11211

php安装扩展

cd /
wget https://codeload.github.com/php-memcached-dev/php-memcached/zip/master
tar zxvf memcached-1.5.3.tar.gz
cd /memcached-1.5.3
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

如果执行phpize时提示“Cannot find config.m4”错误,
可以到php源码包的ext目录里面任一扩展复制一个config.m4文件到memcached目录里面,再次phpize即可

cd /php-7.1.2/ext/mbstring
cp config.m4 /memcached-1.5.3
cd /memcached-1.5.3
/usr/local/php/bin/phpize

有时make也会提示WARNING: ‘automake-1.15’ is missing on your system. ,这里需要更新automake版本

cd /
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz
tar zxvf autoconf-2.68.tar.gz
cd autoconf-2.68
./configure
make && make install
cd /
wget http://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.gz
tar zxvf automake-1.15.1.tar.gz
cd automake-1.15.1
./configure
make && make install
cd /memcached-1.5.3
make && make install
相关文章
相关标签/搜索