centos7 安装memcached以及扩展

来源:互联网 发布:吾生也有涯 知也无涯 编辑:程序博客网 时间:2024/06/07 05:37

安装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 9memcachedSTORED
get runoobVALUE runoob 0 9memcached
wget http://pecl.php.net/get/memcache-2.2.7.tgz               tar -zxvf memcache-2.2.7.tgzcd memcache-2.2.7/usr/local/php/bin/phpize./configure --with-php-config=/usr/local/php/bin/php-configmake && 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.tgzcd 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-dirmake && 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
                                             
0 0
原创粉丝点击