安装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 STOREDget runoob VALUE runoob 0 9 memcachedwget 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 installEND
恭喜你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