Install Memcache in Linux

Source: Internet
Author: User
To install Memcached on the memcached server depends on libevent, you must first install libevent. Install libevent#tarzxvflibevent-2.0.21-stable.tar.gz # cdlibevent-2.0.21-stable #. configure -- prefixusrlocallibevent # makemakeinstall install memcached server # wgethtt

To install Memcached on the memcached server depends on libevent, you must first install libevent. Install libevent # tar zxvf libevent-2.0.21-stable.tar.gz # cd libevent-2.0.21-stable #./configure -- prefix =/usr/local/libevent # make install memcached server # wget htt

Install Memcached Server

Memcached depends on libevent and needs to be installed first.

Install libevent

# tar zxvf libevent-2.0.21-stable.tar.gz# cd libevent-2.0.21-stable# ./configure --prefix=/usr/local/libevent# make && make install

Install memcached Server

# wget http://www.memcached.org/files/memcached-1.4.20.tar.gz# tar zxvf memcached-1.4.20.tar.gz # cd memcached-1.4.20# ./configure --prefix=/usr/local/webserver/memcached --with-libevent=/usr/local/libevent# make && make install

Start memcached

# cd /usr/local/webserver/memcached/# ./bin/memcached -d -m 32 -u root -p 11211 -c 128 –P /tmp/memcached.pid
Startup parameters:

The-d option is to start a daemon.
-U root indicates that the user who starts memcached is root.
-M indicates the amount of memory allocated to Memcache. The unit is MB. The default value is 64 MB.
-M return error on memory exhausted (rather than removing items ).
-U is the user who runs Memcache. If it is currently root, you need to use this parameter to specify the user.
-P is the port used to set TCP listening for Memcache, preferably over 1024.
-The c option is the maximum number of concurrent connections. The default value is 1024.
-P is the pid file for saving Memcache.

Original article address

Http://yidao620c.iteye.com/blog/1899814

Http://blog.csdn.net/kongqz/article/details/6695417

========================================================== ========================================================== ====

Install memcache extension in PHP

Memcached: http://pecl.php.net/package/memcached
Memcache: http://pecl.php.net/package/memcache

# wget http://pecl.php.net/get/memcache-2.2.7.tgz# tar zxvf memcache-2.2.7.tgz# cd memcache-2.2.7# ./configure --enable-memcache --with-php-config=/usr/local/webserver/php/bin/php-config --with-zlib-dir# make && make install

After compilation, modify php. ini to add extension = memcache. so and restart php-fpm.

Install memcached extension in PHP
# wget http://launchpadlibrarian.net/66527034/libmemcached-0.48.tar.gz# cd libmemcached-0.48# ./configure --prefix=/usr/local/libmemcached  --with-memcached# make && make install

Notes for installation:

1. Do not forget to install it. -- with-memcached. Otherwise, you will be prompted.
Checking for memcached... no
Configure: error: "cocould not find memcached binary"

2. Is your memcached above 1.2.4? If not, you will be prompted
Clients/ms_thread.o: In function 'Ms _ setup_thread ':
/Home/zhangy/libmemcached-0.42/clients/ms_thread.c: 225: undefined reference to '_ sync_fetch_and_add_4'
Clients/ms_thread.o:/home/zhangy/libmemcached-0.42/clients/ms_thread.c: 196: more undefined references to '_ sync_fetch_and_add_4' follow
Collect2: ld returned 1 exit status
Make [2]: *** [clients/memslap] Error 1
Make [2]: Leaving directory '/home/zhangy/libmemcached-0.42'

Solution is -- disable-64bit CFLAGS = "-O3-march = i686", if you don't need this 64-bit long data, I want php to expand memcached, memcache will be no difference, it doesn't make much sense to install memcached.

# wget http://pecl.php.net/get/memcached-2.2.0.tgz# cd memcached-2.2.0# /usr/local/webserver/php/bin/phpize# ./configure --enable-memcached --with-php-config=/usr/local/webserver/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached-saslchecking for sasl/sasl.h... noconfigure: error: no, sasl.h is not available. Run configure with --disable-memcached-sasl to disable this check# make && make install

After compilation, modify php. ini to add extension = memcached. so and restart php-fpm.

Original article address

Https://www.centos.bz/2011/11/linux-install-php-memcache/

Http://blog.51yip.com/php/928.html

Original article address: Install Memcache in Linux. Thank you for sharing it with me.

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.