memcache缓存技术应用
工具/原料
电脑,memcache
一、安装memcache:
1、 安装memcache在linux系统中安装memcache
2、上传软件到linux系统:
二、安装libevent依赖软件:
1、一彤艘藻狠.安装libevent安装libevent命令:shell#tar zxvf libevent-2.0.21-stable.tar.gz shell#cd libevent-2.0.21-stable shell#./configure --prefix=/usr/local/libevent shell#make shell#make install至此libevent安装完毕;二.安装memcache服务软件安装memcached命令:shell#tar zxvf memcached-1.4.25.tar.gz shell#cd memcached-1.4.25 shell#./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent/shell#makeshell#make install 至此memcached安装完毕;
2、启动memcache服务
三、php安装memcache扩展:
1、下图,在memcache解压目录里边执行phpizephp的扩展(依赖):gd、xml、pdo、mysql、memc锾攒揉敫ache、redis、mb_string等等软件本身、依赖软件的安装顺序:先依赖软件、再软件本身目前的情况是,php软件本身已经安装完毕,但是我们还想给其安装memcache扩展,显然,软件安装顺序出现问题。现在技术在提高,扩展软件后安装也可以成为php的扩展功能(php不需要重复安装)必要步骤:扩展软件安装的时候先执行一次/usr/local/php/bin/phpize
2、php安装memcache扩展安装memcache-2.2.7.tarshell#tar xvf memcac茑霁酌绡he-2.2.7.tarshell#cd memcache-2.2.7shell#/usr/local/php/bin/phpizeshell#./configure--enable-memcache --with-php-config=/usr/local/php/bin/php-config --with-zlib-dirshell#make && make install
3、php.ini开启memcache扩展
4、重启apache.
5、给php安装memcache成功:
四、memcache项目中的应用:
1、memcache项目中的应用代码编写。