centos7 安裝memcached以及擴充套件

hwk_yellow發表於2016-11-16

安裝memcached

yum install memcached


啟動 memcached

/usr/bin/memcached -d -m 64M -u root -l 192.168.1.118 -p 11211 -c 256 -P /tmp/memcached.pid

檢視程式

ps  -aux |grep memcached

使用memcached

yum install telnet

telnet  192.168.1.118 11211


測試

set runoob 0 900 9
memcached
STORED

get runoob
VALUE runoob 0 9
memcached

wget http://pecl.php.net/get/memcache-2.2.7.tgz               
tar -zxvf memcache-2.2.7.tgz
cd memcache-2.2.7
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
END

恭喜你memcached安裝成功了.

memcached 擴充套件

PHP 連線 Memcached 服務

PHP memcache 擴充套件包下載地址:http://pecl.php.net/package/memcache,你可以下載最新穩定包


wget http://pecl.php.net/get/memcache-2.2.7.tgz               
tar -zxvf memcache-2.2.7.tgz
cd memcache-2.2.7
/usr/bin/phpize
./configure --with-php-config=/usr/bin/php-config
(如果失敗重新來換作)
./configure --enable-memcache --with-php-config=/usr/bin/php-config --with-zlib-dir

make && make install
(如果make失敗,yum install -y zlib.x86_64 zlib-devel.x86_64)


修改php檔案

vi /etc/php.ini

新增

extension = memcache.so

重啟 apache
systemctl restart httpd.service #重啟apache


            

相關文章