阿里云ubuntu OCS安装memcache+php5教程
发布:smiling 来源: PHP粉丝网 添加日期:2015-05-06 11:31:13 浏览: 评论:0
下文小编来为各位介绍阿里云ubuntu OCS安装memcache+php5教程,希望下文可以帮助到各位朋友.
阿里云ubuntu OCS在已装memcache下的安装部骤如下:
1.apt-get 安装 php5-dev libsasl2-dev cloog-ppl
sudo apt-get install php5-dev libsasl2-dev cloog-ppl
2.安装libmemcached(必须是如下版本)
- wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz
- tar zxvf libmemcached-1.0.16.tar.gz
- cd libmemcached-1.0.16
- ./configure --prefix=/usr/local/libmemcached
- make; make install; make clean
- cd ..
3.安装过程memcached(必须是如下版本)
- wget http://pecl.php.net/get/memcached-2.1.0.tgz
- tar zxvf memcached-2.1.0.tgz
- cd memcached-2.1.0
- phpize5
- ./configure --with-libmemcached-dir=/usr/local/libmemcached --enable-memcached-sasl
- make; make install; make clean
4.配置php支持memcache
- echo "extension=memcached.so" >>/etc/php5/conf.d/pdo.ini
- echo "memcached.use_sasl = 1" >>/etc/php5/conf.d/pdo.ini
5.查看是否安装成功
php -m |grep mem
6.重启apache
service apache2 restart
7.测试
- $connect = new Memcached;
- $connect->setOption(Memcached::OPT_COMPRESSION, false);
- $connect->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
- $connect->addServer('host', port);
- $connect->setSaslAuthData('username', 'password');
- $connect->set("hello", "world");
- echo 'hello: ',$connect->get("hello");
- $connect->quit(); //phpfensi.com
Tags: ubuntu OCS安装
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)