Php5.3 how to install libmemcached extension

Source: Internet
Author: User
Tags key string php memcached
Libmemcached is a memcached Library, client library, and client library implemented in C and C ++ languages. it has low memory usage, thread security, and provides comprehensive support for memcached functions.

Libmemcached is a memcached Library, client library, and client library implemented in C and C ++ languages. it has low memory usage, thread security, and provides comprehensive support for memcached functions.

PHP memcache client based on libmemcached has many advantages

Hash consistent storage

Multi get/set

The key is automatically hashed to int, avoiding the limit that the memcache key string is less than 255Byte by default.

I haven't configured the server for a long time. I always thought that libmemcached's php memcached has been included in the basic installation package. In the end, I still need to compile it myself. The entire installation process is a lot of dark holes and I tried it several times before it was successful.

Two steps for installation

Install libmemcached to the so and header files

Install memcachedphp extensions

Libmemcaced is divided into two major versions: 0. x and 1.x, 1. the version of x starts from, and compilation is very troublesome. it requires special configuration of gcc4.0 or above, and compile is extremely slow. 0. version x is much simpler. The maximum version is 0.53. Therefore, install version 0.53.

Php memcahed starts from 2.1.0, and libmemcached must be 1.0.x.

Libmemcaced I used 0.53, so php-memcahed chose 2.0.0. version maintenance of open-source software is a mess.

Install libmemcached

Wget https://launchpad.net/libmemcached/1.0/0.53/+download/libmemcached-0.53.tar.gz
Tar xvfz libmemcached-0.53.tar.gz
Cd libmemcached-0.53
./Configure -- prefix =/opt/libmemcached
Make & make install

Install php extension

Wget http://pecl.php.net/get/memcached-2.0.0.tgz
Tar zvxf memcached-2.0.0.tgz
Cd memcached-2.0.0/
./Configure -- enable-memcached -- with-php-config =/usr/local/php/bin/php-config -- with-libmemcached-dir =/opt/libmemcached/
Make & make install
Make install is to install memcached. so to $ {php install dir}/extensions/no-debug-non-zts-20090626/, which varies with the php version

In the last step, modify php. ini and add extension = memcached. so.

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.