本想說這東西就yum一下就好了...
沒想到重裝時,還真卡住了,想不起來怎麼裝的
還是乖乖寫筆記吧
Reference
10 baby steps to install Memcached Server and access it with PHP
沒想到重裝時,還真卡住了,想不起來怎麼裝的
還是乖乖寫筆記吧
- 架memcache server
- 事前準備
yum install libevent
yum install libmemcached libmemcached-devel - 裝memcache server
yum install memcached - Start Memcached server
memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody
d = daemon, m = memory, u = user, l = IP to listen to, p = port)
- 事前準備
- php存取memcache
- 事前準備
利用pecl安裝,如果沒有的...
yum install php-pear - 安裝memcache
pecl install memcache - 設定php.ini
將extension寫入php.ini
extension=memcache.so - 設定memcache server位置
$memcache = new Memcache; $memcache->connect('127.0.0.1', 11211) or die ("Could not connect"); //connect to memcached server $mydata = "i want to cache this line"; //your cacheble data $memcache->set('key', $mydata, false, 100); //add it to memcached server $get_result = $memcache->get('key'); //retrieve your data var_dump($get_result); //show it
- 事前準備
Reference
10 baby steps to install Memcached Server and access it with PHP
沒有留言:
張貼留言