From previous HOW TO - http://www.bxtra.net/Articles/2010-04-27/How-install-Memcached-CentOS-DirectAdmin-installed-Memcached-PECL I just think that I should note an update how to install Memcached so that I, myself, can follow the steps here and get the latest version. The steps are almost exactly to my previous Memcached PECL installed. Only a few changes to install an updated version.
Get Libevent which is require to install Memcached. Their homepage is here -> http://www.monkey.org/~provos/libevent/
wget http://monkey.org/~provos/libevent-2.0.10-stable.tar.gz tar -xvf libevent-2.0.10-stable.tar.gz cd libevent-2.0.10-stable ./configure;make;make install;
Then, get Memcached from http://memcached.org
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz gunzip memcached-1.4.5.tar.gz tar -xvf memcached-1.4.5.tar cd memcached-1.4.5 ./configure;make;make install;
For me, I got an error below when try to run memcached :
memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
So, I did steps below :
ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
Once you're done with that, try run
memcached -d -u nobody -m 1024 127.0.0.1 -p 11211
This is not done yet, you need to let PHP knows to be able to use memcached.
wget http://launchpad.net/libmemcached/1.0/0.48/+download/libmemcached-0.48.tar.gz tar xvfz libmemcached-0.48.tar.gz cd libmemcached-0.48 ./configure
You will see screen below :
Then, run
make && make install
Then install Memcached PECL with below command :
pecl install memcached
Once it's done, you may notice that the extension path is different to what we normally see. What you will see is :
/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626
But what most module for PHP 5.3 installed will compile into
/usr/local/lib/php/extensions/no-debug-non-zts-20090626
Therefore, make sure you get the right path for extension_dir Edit php.ini to have lines below : (Make sure the line "extension_dir" is there or you need a full path to memcached.so )
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626" extension=memcached.so
Then, restart HTTP and check PHP Status.. You will see Memcached info as below:
In case you need to use Memcached as a session handler. (Not require) Then, you need to edit php.ini and set variable below :
session.save_handler=memcached session.save_path="127.0.0.1:11211"
Now, you're done install Memcached on the server. However, you need to modify some code in your website script to make use of Memcached.
Server Information - Software
- CentOS 5.5
- DirectAdmin 1.38
- Apache 2.2.17
- PHP 5.3.6
- MySQL 5.5.9
Source :
- http://blog.ajohnstone.com/archives/installing-memcached/
- http://alexle.net/archives/275
- http://hasin.wordpress.com/2009/10/18/using-new-pecl-memcached-extension-for-storing-session-data/
thanks, i installed memcached
I getting error
[root@tigapoin libmemcached-1.0.5]# libmemcached/auto.cc: In function 'memcached_return_t text_incr_decr(memcached_server_st*, bool, const char*, size_t, uint64_t, bool)': -bash: libmemcached/auto.cc:: No such file or directory [root@user libmemcached-1.0.5]# pecl install memcached downloading memcached-2.0.1.tgz ... Starting to download memcached-2.0.1.tgz (39,088 bytes) ..........done: 39,088 bytes 11 source files, building running: phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 building in /tmp/pear/install/pear-build-root96ENJx/memcached-2.0.1 running: /tmp/pear/install/memcached/configure checking for egrep... grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ANSI C... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... i686-redhat-linux-gnu checking host system type... i686-redhat-linux-gnu checking target system type... i686-redhat-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib checking for PHP extension directory... /usr/lib/php/modules checking for PHP installed headers prefix... /usr/include/php checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking whether to enable memcached support... yes, shared checking for libmemcached... yes, shared checking whether to enable memcached session handler support... yes checking whether to enable memcached igbinary serializer support... no checking whether to enable memcached json serializer support... no checking whether to disable memcached sasl support... no checking for ZLIB... yes, shared checking for zlib location... /usr checking for session includes... /usr/include/php checking for memcached session support... enabled checking for memcached igbinary support... disabled checking for libmemcached location... configure: error: memcached support requires libmemcached. Use --with-libmemcached-dir=
how to fix?
Got same error with new
I have update
I have update
Just tested with version 1.0
Just tested with version 1.0.7 and it works ok now.
Update : Well spoke too soon.. "./configure" was now compiled ok but after ran "make & make install" , below is the error I got :
CXX libhashkit/libmemcached_libmemcached_la-strerror.lo
CXX libhashkit/libmemcached_libmemcached_la-string.lo
CXX libhashkit/libmemcached_libmemcached_la-nohsieh.lo
CXX libmemcached/libmemcached_libmemcached_la-allocators.lo
CXX libmemcached/libmemcached_libmemcached_la-analyze.lo
CC libmemcached/libmemcached_libmemcached_la-array.lo
CXX libmemcached/libmemcached_libmemcached_la-auto.lo
libmemcached/auto.cc: In function 'memcached_return_t text_incr_decr(memcached_server_st*, bool, const char*, size_t, uint64_t, bool)':
libmemcached/auto.cc:73: error: expected `)' before 'PRIu64'
make[1]: *** [libmemcached/libmemcached_libmemcached_la-auto.lo] Error 1
make[1]: Leaving directory `/root/libmemcached-1.0.7'
make: *** [all] Error 2
If it helps, the main problem
Thanks Adam, I followed your
I had the same issue
zilb was in /lib64 and autoconf was not able to locate, intalling zlib-devel gave it direct my giving pkgconfig.