CentOS环境PHP安装memcache扩展
2015-06-05 10:09
656 查看
安装memcache
安装libmemcached库
PHP安装Memcache扩展
启动
测试:
View Code
问题:
1.找不到php-config
2.找不到 ZLIB memcache support requires ZLIB
3.can't run as root without the -u switch
参考:
centos 为php安装memcache.http://blog.csdn.net/php_boy/article/details/6880488
CentOS环境PHP安装memcache扩展.http://blog.phpha.com/archives/1554.html
Centos安装Memcache./article/5268589.html
yum install memcached
安装libmemcached库
yum install libmemcached
PHP安装Memcache扩展
root@blog.phpha.com] wget -c http://pecl.php.net/get/memcache-3.0.8.tgz [root@blog.phpha.com] tar -zxvf memcache-3.0.8.tgz [root@blog.phpha.com] cd memcache-3.0.8 [root@blog.phpha.com] /usr/local/php/bin/phpize [root@blog.phpha.com] ./configure -with-php-config=/usr/bin/php-config -with-zlib-dir [root@blog.phpha.com] make && make install #Installing shared extensions: /usr/lib64/php/modules/ #/usr/lib64/php/modules/memcache.so [root@blog.phpha.com] vim /etc/php.ini #extension = /usr/lib64/php/modules/memcache.so [root@blog.phpha.com] service php-fpm reload
启动
memcached -d -u root -p 11211
测试:
<?php $mem = new Memcache; $mem->addServer("localhost",11211); echo "Version:".$mem->getVersion(); class testClass{ private $str_attr; private $int_attr; public function __construct($str,$int) { $this->str_attr = $str; $this->int_attr = $int; } public function set_str($str) { $this->str_attr = $str; } public function set_int($int) { $this->int_attr = $int; } public function get_str() { return $this->str_attr; } public function get_int() { return $this->int_attr; } } $test = new testClass("hell world",1123); $mem->set("key",$test,false,1000); var_dump($mem->get("key")); $test_array = array("index_1"=>"hello","index_2"=>"world"); $mem->set("array_test",$test_array,false); var_dump($mem->get("array_test")); ?>
View Code
问题:
1.找不到php-config
find / -name php-config
2.找不到 ZLIB memcache support requires ZLIB
yum install zlib-devel
3.can't run as root without the -u switch
memecached -u root start
参考:
centos 为php安装memcache.http://blog.csdn.net/php_boy/article/details/6880488
CentOS环境PHP安装memcache扩展.http://blog.phpha.com/archives/1554.html
Centos安装Memcache./article/5268589.html
相关文章推荐
- memcache
- Memcached真的过时了吗?
- 整理php操作memcache缓存基础方法
- Memcached--永久数据被踢现象
- Memcached缓存无底洞现象
- Memcached缓存雪崩现象
- Memcached集群--一致性哈希算法
- PHP memcache 原子增减实例
- How to install php memcached on CentOS 6.5
- 整理php操作memcache缓存基础方法
- Java memcache Client 数据操作源码剖析
- memcache--key的命名规范:
- PHP安装memcache扩展(MAC)
- php操作memcache缓存方法分享
- php操作memcache缓存方法分享
- Linux下搭建Memcached缓存系统
- Memcached缓存集群_创建多实例
- 用Varnish和Memcached缓存给WordPress网站提速-内存级加速
- PHP Memcached的扩展
- PHP中编译Memcached的扩展