阿里云怎样使用memcache和ocs
1个回答
展开全部
apt-get 安装 php5-dev libsasl2-dev cloog-pplsudo apt-get install php5-dev libsasl2-dev cloog-ppl
安装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 ..
安装过程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
配置php支持memcache
echo "extension=memcached.so" >>/etc/php5/conf.d/pdo.ini
echo "memcached.use_sasl = 1" >>/etc/php5/conf.d/pdo.ini
查看是否安装成功php -m |grep mem
重启apacheservice apache2 restart
测试安装是否成
$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();
END
注意事项
ECS必须先安装memcache客户端
安装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 ..
安装过程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
配置php支持memcache
echo "extension=memcached.so" >>/etc/php5/conf.d/pdo.ini
echo "memcached.use_sasl = 1" >>/etc/php5/conf.d/pdo.ini
查看是否安装成功php -m |grep mem
重启apacheservice apache2 restart
测试安装是否成
$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();
END
注意事项
ECS必须先安装memcache客户端
Jtti
2024-10-10 广告
2024-10-10 广告
Jtti是一家新加坡全球网络基础服务商,为数百万个网站提供支持,提供香港服务器、新加坡服务器等多种全球服务器,自营全球多个数据中心,为用户提供优质的网络资源和服务。
JTTI服务器整体性能是非常不错的,拥有CN2 GIA+BGP优化线路,多...
点击进入详情页
本回答由Jtti提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询