Aliyun Ubuntu OCS Installation MEMCACHE+PHP5 Tutorial

Source: Internet
Author: User
Tags ini memcached aliyun

The installation department of Aliyun Ubuntu OCS under installed Memcache is as follows:

1.apt-get installation Php5-dev Libsasl2-dev CLOOG-PPL
sudo apt-get install Php5-dev libsasl2-dev cloog-ppl

2. Install libmemcached (must be the following version)


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. Installation process memcached (must be the following version)


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. Configure PHP support Memcache


echo "Extension=memcached.so" >>/etc/php5/conf.d/pdo.ini
echo "MEMCACHED.USE_SASL = 1" >>/etc/php5/conf.d/pdo.ini

5. See if the installation is successful

Php-m |grep Mem

6. Restart Apache

Service Apache2 Restart

7. Test


$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 ();
?>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.