Here's a short guide on installing the php 4 memcached extension from source. I write it as a reference as I couldn't find some precise instructions on this.
Download and extract the source code:
system:~# wget http://pecl.php.net/get/memcache-2.1.2.tgz
system:~# tar xvfz memcache-2.1.2.tgz
Prepare the extension for compiling:
system:~# cd memcache-2.1.2
system:~/memcache-2.1.2# phpize
Configure, make and make install:
system:~/memcache-2.1.2# ./configure
system:~/memcache-2.1.2# make
system:~/memcache-2.1.2# make install
If configure fails with the following error: configure: error: Cannot find php_session.h (as it did on ubuntu and debian for me) then you'll have to create a symbolic link to /usr/include/php4 called /usr/include/php. If you don't have one of those directories, then you're probably missing the php4-dev package.

