阿里云ubuntu OCS安装memcache+php5教程
2019/10/10/17:45:01 阅读:1844 来源:谷歌SEO算法 标签:
DNS
下文小编来为各位介绍阿里云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(必须是如下版本)
- wgethttps://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz
- tarzxvflibmemcached-1.0.16.tar.gz
- cdlibmemcached-1.0.16
- ./configure--prefix=/usr/local/libmemcached
- make;makeinstall;makeclean
- cd..
3.安装过程memcached(必须是如下版本)
- wgethttp://pecl.php.net/get/memcached-2.1.0.tgz
- tarzxvfmemcached-2.1.0.tgz
- cdmemcached-2.1.0
- phpize5
- ./configure--with-libmemcached-dir=/usr/local/libmemcached--enable-memcached-sasl
- make;makeinstall;makeclean
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=newMemcached;
- $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
热门评论