Installation based on the libmemcached,php expansion memcached

Source: Internet
Author: User
Tags cas
Installation based on the libmemcached,php extended memcached

One, why install memcached extension

Memcached's 1.2.4 and above increase the CAS (Check and Set) protocol for concurrent processing of multiple trips to the same key. In fact, the root database is very similar, if there are several processes on the same table of the same data to update, it will not fight, haha. The database can lock the entire table, you can also lock the table inside the function of a row, in fact, Memcached joined the CAS root this almost.

PHP extension memcache, does not support CAs, so we want to install memcached extension, memcached extension is based on libmemcached, so we will first installed libmemcached

?

Second, view the version information for memcahced

Telnet 127.0.0.1 12000
Stats
You will see the following information
STAT PID 15322
STAT Uptime 1885
STAT Time 1279455772
STAT version 1.2.8
STAT Pointer_size 32
If the version is too low, consider reloading

Quit Telnet,Ctrl +] and then press Q on the line.

Third, install the required software

wget http://launchpad.net/libmemcached/1.0/0.42/+download/libmemcached-0.42.tar.gz

wget http://pecl.php.net/get/memcached-1.0.2.tgz

Memcached's official website http://www.memcached.org/

Four, install libmemcached

Tar zxvf libmemcached-0.42.tar.gz
CD libmemcached-0.42
./configure–prefix=/usr/local/libmemcached? –with-memcached
Make && make install

Installation issues to be aware of:

1,? Do not forget to install the process, –with-memcached, or you will be prompted

Checking for memcached ... no
Configure:error: "Could not find memcached binary"

2, your memcached is not 1.2.4 or more, if you are not 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′

The solution is –disable-64bit cflags= "-o3-march=i686″, if you do not use this 64-bit long data, I think the PHP extension Memcached,memcache is no different, It's no fun pretending to be a memcached.

Five, the installation of PHP extension memcached

Tar zxvf memcached-1.0.2.tar.gz
CD memcached-1.0.2
/usr/local/php/bin/phpize
./configure–enable-memcached–with-php-config=/usr/local/php/bin/php-config–with-libmemcached-dir=/usr/local/ Libmemcached
./configure–prefix=/usr/local/phpmemcached? –with-memcached
Make && make install

Vi/usr/local/php/lib/php.ini

Plus extension=memcached.so to re-start the service.

?

Reprint: http://blog.51yip.com/php/928.html

  • 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.