memcached and new PHP client memcached Assembly (reference)

Source: Internet
Author: User
Tags php memcached
Memcached and PHP New client memcached installation (reference)
2010-02-23 11:05web2.0 and web1.0 are different, web1.0 content-centric, so web1.0 do the load just cache the content, using the reverse proxy cache page can solve most problems. and web2.0 encourages user interaction, the content is dynamic, only to do reverse proxy life if the middle rate is low, and the database is frequently written, the pressure on the database. Therefore, web2.0 needs to use a memory cache for web1.0. Memcached high-performance, distributed memory object cache system that reduces database load and improves access speed in dynamic applications. Memcached has been widely used in a variety of software, such as Nginx, MySQL one, server-side installation using Weget download Libevent and memcachedlibevent:http://monkey.org/~provos/ libevent-1.4.9-stable.tar.gzmemcached:http://www.danga.com/memcached/dist/  Memcached-1.2.6.tar.gz1. Install Libeventtar zxvf libevent-1.4.9-stable.tar.gz cd libevent-1.4.9-stable first./configure make Make install tar zxvf libevent-1.4.9-stable.tar.gz CD Libevent-1.4.9-stable./configuremakemake  Install2. Installing Memcachedtar zxvf memcached-1.2.6.tar.gz cd memcached-1.2.6./configure--enable-threads make make install Tar zxvf memcached-1.2.6.tar.gzcd memcached-1.2.6./configure--enable-threadsmakemake Install Note: If "memcached" appears at startup: Error while loading shared Libraries:libevent-1.4.so.2:cannot openshared object file:no such file or directory "information that represents Memcached can not find the location of Libevent, first use the Whereis libevent to get the location, and then connect to the path that memcached looked for [[email protected] tools]# whereis libevent libevent:/usr/local /LIB/LIBEVENT.LA/USR/LOCAL/LIB/LIBEVENT.SO/USR/LOCAL/LIB/LIBEVENT.A [[email protected] tools]# LD_DEBUG=libs Memcached-v 2>&1 >/dev/null | less [[email protected] tools]# ln-s/usr/local/lib/libevent-1.4.so.2/lib64/II, PHP installation support for memcached PHP has two versions of the memcached client 1.memcached This is a new version of the client based libmemcached, so you must install libmemcached first install libmemcached download address: http ://download.tangent.org/libmemcached-0.26.tar.gz[[email protected] tools]# tar zxvf libmemcached-0.26.tar.gz [ [email protected] tools]# CD libmemcached-0.26 [[email protected] libmemcached-0.26]#./configure--prefix= /usr/local/libmemcached/--with-libmemcached-dir=/usr/local/libmemcached/[[email protected] libmemcached-0.26]# make [[email protected] libmemcached-0.26]# make install [[email protected] tools]# tar Z XVF libmemcached-0.26.tar.gz[[email protected] tools]# cd liBmemcached-0.26[[email protected] libmemcached-0.26]#/configure--prefix=/usr/local/libmemcached/-- With-libmemcached-dir=/usr/local/libmemcached/[[email protected] libmemcached-0.26]# make[[email  Protected] libmemcached-0.26]# make install install PHP memcached and the latest client download address: Http://pecl.php.net/get/memcached[[email  protected] tools]# tar zxvf memcached-0.1.4.tgz [[email protected] tools]# CD memcached-0.1.4 [[Email p] Rotected] memcached-0.1.4]#./configure--with-php-config=/usr/local/php/bin/php-config--with-libmemcached-dir=/ usr/local/libmemcached/[[email protected] memcached-0.1.4]# make [[email protected] memcached-0.1.4]# make install [[email protected] tools]# tar zxvf memcached-0.1.4.tgz[[email protected] tools]# CD memcached-0 .1.4[[email protected] memcached-0.1.4]#./configure--with-php-config=/usr/local/php/bin/php-config-- With-libmemcached-dir=/usr/local/libmemcached/[[email protected] memcached-0.1.4]# make[[email&Nbsp;protected] memcached-0.1.4]# make install modify php.ini Add extension = "memcached.so" on it. 1. Checking for libmemcached location ... configure:error:memcached support requires libmemcached. Use--with-libmemcached-dir=
 
  
 To specify the prefix where libmemcached headers and library is located checking for libmemcached location ... Configur E:error:memcached support requires libmemcached. Use--with-libmemcached-dir=
  
   
 To specify the prefix where libmemcached headers and library is located please first locate the path with Whereis libmemcached and then add the option--WITH-LIBMEMC ached-dir=libmemcached path 2.memcache Download address: http://pecl.php.net/get/memcache[[email protected] tools]# tar zxvf memcache-3.0.3.tgz [[email protected] tools]# CD memcache-3.0.3 [[email protected] tools]#/usr/local/php/ Bin/phpize [[email protected] tools]#./configure--with-php-config=/usr/local/php/bin/php-config [Email  protected] tools]# make [[email protected] tools]# make install [[email protected] tools]# tar zxvf MEMC ache-3.0.3.tgz [[email protected] tools]# CD memcache-3.0.3[[email protected] tools]#/usr/local/php/bin/ Phpize[[email protected] tools]#./configure--with-php-config=/usr/local/php/bin/php-config[[email  Protected] tools]# make[[email protected] tools]# make install modify php.ini Add extension = "memcache.so" on it. Tip: If PHP cannot find the so file, set Extension_dir. PS: This article in the draft box to stay for a long time, and finally decided to put a more than one post, so feel much faster. Source: http://willko.iteye.com/blog/332993netseek (2009-9-10 11:16:40) memcached client libmemcached, when processing value more than 8k of data, the speed will be straight down, In Http://lists.tangent.org/piperma. ovember/000484.html, you can find the answer because Libmemcached buf is too small to find the source file Memcached_ Constants.h, modify the # define Memcached_max_buffer 8196, change to the appropriate size, recompile, install, and you can. Libmemcached is the interface of the C client library to the MEMCACHED server. It is designed for lightweight memory usage, thread-safe, and provides a way to get a full server-side approach. It also employs a variety of command-line tools: Memcat, Memflush, MEMRM, MemStat, and memslap (load generation). The library has been designed to let different hashing methods pair the keys, split the keys, and use a uniform hash distribution. License: BSD License (revision) change: Fixed descending hash key. The corrected assertion is that the host_reset () called by the memset () is not well caught. Fixed an issue where clearing blocked I/O has been stacked. Supplementary MemStat. A new API for flushing water. memcached Simple Tutorial This is a project-based article: memcached is a tool for fast data access, and Wikipedia and Facebook use it to improve speed. The specific situation can be wiki.c/c++ inside use memcached originally is very simple thing, but is no one said, do not want me to read Libmemcache instance code just line, Manpage also didn't say clearly (but also have to see). If you want to use memcached, proceed as follows: 1 install memcached You can go to the official website to download, or sudo apt-get install MEMCACHED2 Test your installation, such as running memcached-d-M 64-l 127. 0.0.1-p 12300-d for background,-m 64 means using 64MB memory,-l 127.0.0.1-p 12300 means listening 127.0.0.1:12300 port no message is running successfully 3 installation libmemcached This is not the AP T anymore, because there's no preciseLibmemcached bag, go to the official website to download it. This thing also need to libevent, this can not apt,libevent install the time best loaded into/usr/lib inside, otherwise libmemcached still can't run.  4 Test libmemcached Find a file such as test, and then run MEMCP test--servers=127.0.0.1:12300 to copy the test into the memcached managed memory.  Memcat Test--servers=127.0.0.1:12300 See if that file was just.
  
 
  • 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.