Install memcached and php extension tests in ubuntu.

Source: Internet
Author: User

Install memcached and php extension tests in ubuntu.

1. memcached requires libevent, so install it first.

: Http://download.chinaunix.net/download.php? Id = 45065 & ResourceID = 5804

Tar xf libevent-2.0.21-stable.tar.gz

Cd libevent-2.0.21-stable

Make

Sudo make install

2. Install memcached

Wget http://memcached.org/files/memcached-1.5.5.tar.gz

Tar xf memcached-1.5.5.tar.gz

Cd memcached-1.5.5/

./Configure -- with-libevent =/usr/local/libevent

Make & sudo make install

3. Install the memcache extension of php.

Wget http://pecl.php.net/get/memcache-2.2.7.tgz

Tar xf memcache-2.2.7.tgz

Cd memcache-2.2.7/

/Usr/local/php54/bin/phpize

./Configure -- enable-memcache -- with-php-config =/usr/local/php54/bin/php-config -- with-zlib-dir

[If zlib is not available, install zlib first]

Wget http://www.zlib.net/fossils/zlib-1.2.11.tar.gz

Tar xf zlib-1.2.11.tar.gz

Cd zlib-1.2.11/

./Configure

Make & sudo make install

Then install memcache.

Make & sudo make install

4. add extensions in php. ini.

Extension = memcache. so

5. Start the memcached server.

/Usr/local/bin/memcached-d-m 10-u root-l 127.0.0.1-p 12000-c 256-P/tmp/memcached. pid

-D option is to start a daemon,
-M indicates the amount of memory allocated to Memcache. The unit is MB. Here I am 10 MB,
-U is the user who runs Memcache. Here I am root,
-L is the IP address of the listener server. If there are multiple IP addresses, I have specified the Server IP address 127.0.0.1.
-P is the port for Memcache listening. I have set port 12000 here, preferably port 1024 or above,
-The "c" option is the maximum number of concurrent connections. The default value is 1024. I have set 256 here, which is based on the load of your server,
-P is the pid file for saving Memcache. Here I save it in/tmp/memcached. pid,

6. Compile the test file

<?php    $mem = new Memcache;    $mem->connect( "127.0.0.1", 12000 );    $mem->set( "hi", "hello,ghostwu", 0, 120 );    echo $mem->get( "hi" ) . PHP_EOL;?>

 

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.