Howto : Enabling memcached extension on php.

Posted on Updated on

Memcached is a general-purpose distributed memory caching system, but is now used by many other sites. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read. Memcached runs on Unix, Windows and MacOS and is distributed under a permissive free software license.

Installation :

You may simply install mamcached using pacl library, but it need the dependency package libmencached download , When compailing you might got an error mamcached not found so tha you may use some parameters with configuring like  –without-memcached

error Output:

checking for memcached session support... enabled
checking for memcached igbinary support... disabled
checking for memcached location... configure: error: libmemcached support requires libmemcached. Use --with-memcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located
ERROR: `/tmp/pear/temp/memcached/configure' failed

Step :1- (Libmamcached Installation )

1.# wget
2.# tar -zxvf libmemcached-0.50.tar.g
3.# cd libmemcached-0.5
4.#./configure --without-memcached && make && make install

Step:2 (Memcached installation)

1.#pecl install memcache
2.#echo "extension=/usr/lib/extensions/no-debug-zts-20060613/" >> /etc/php.ini

Success Output :

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2" install
Installing shared extensions:     /tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2/usr/lib/extensions/no-debug-zts-20060613/
running: find "/tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2" | xargs ls -dils
1974089   4 drwxr-xr-x 3 root root   4096 2011-07-27 11:17 /tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2
1974111   4 drwxr-xr-x 3 root root   4096 2011-07-27 11:17 /tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2/usr
1974112   4 drwxr-xr-x 3 root root   4096 2011-07-27 11:17 /tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2/usr/lib
1974113   4 drwxr-xr-x 3 root root   4096 2011-07-27 11:17 /tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2/usr/lib/extensions
1974114   4 drwxr-xr-x 2 root root   4096 2011-07-27 11:17 /tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2/usr/lib/extensions/no-debug-zts-20060613
1974110 180 -rwxr-xr-x 1 root root 184221 2011-07-27 11:17 /tmp/pear/temp/pear-build-rootmdfn1M/install-memcached-1.0.2/usr/lib/extensions/no-debug-zts-20060613/

Build process completed successfully
Installing '/usr/lib/extensions/no-debug-zts-20060613/'
install ok: channel://
configuration option "php_ini" is not set to php.ini location
You should add "" to php.ini

Thats it..


6 thoughts on “Howto : Enabling memcached extension on php.

    Nelson said:
    August 19, 2011 at 11:39 am

    Thanks for the great article!
    I had to do a few specific changes to compile it on 32 bit cpu:
    ./configure –without-memcached –disable-64bit
    I also had to change lines 658 728 and 787 of clients/ to
    uint64_t value= 0xdeadbeefdeadcafeLL;
    Now it’s running perfect 😉 thanks again ^^

    Batbekh Batmagnai said:
    July 4, 2013 at 1:45 pm

    hi i got that error output and can’t fix it.What gonna i do

      Anand babu responded:
      July 4, 2013 at 7:37 pm

      Let me know the error..

    moh sheh said:
    October 16, 2013 at 3:20 pm

    You’re installing memcahe not memcached (misleading title)

    moh sheh said:
    October 16, 2013 at 3:21 pm

    or may be, it’s just a typo, I don’t know

    Anand babu responded:
    October 16, 2013 at 3:57 pm

    Its not typo.

Leave a Reply to moh sheh Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s