Howto : Enabling memcached extension on php.
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 http://launchpadlibrarian.net/73843684/libmemcached-0.50.tar.g 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/memcached.so" >> /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/memcached.so Build process completed successfully Installing '/usr/lib/extensions/no-debug-zts-20060613/memcached.so' install ok: channel://pecl.php.net/memcached-1.0.2 configuration option "php_ini" is not set to php.ini location You should add "extension=memcached.so" to php.ini
Thats it..
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/memcapable.cc to
uint64_t value= 0xdeadbeefdeadcafeLL;
Now it’s running perfect 😉 thanks again ^^
July 4, 2013 at 1:45 pm
hi i got that error output and can’t fix it.What gonna i do
July 4, 2013 at 7:37 pm
Let me know the error..
October 16, 2013 at 3:20 pm
You’re installing memcahe not memcached (misleading title)
October 16, 2013 at 3:21 pm
or may be, it’s just a typo, I don’t know
October 16, 2013 at 3:57 pm
Its not typo.