Installing Memcached on Ubuntu for PHP

I've been playing around with caching and php, and thought I'd give a little insight on installing memcached on Ubuntu, and enable php-memcached. First start out by opening up your Synaptic Package Manager, search for "php memcached". Select and install "memcached" and "php5-memcache"

Now everything should be installed. Restart Apache for php to recognize the new extension:

sudo apache2ctl restart

Now if you run a php script with phpinfo(); you should see a new section for memcached.

Next you will need to start memcache server, but before you attempt, I'll let you know you're going to get the following error: Starting memcached: memcached disabled in /etc/default/memcached. By default memcache installs with it's startup script disabled(why I don't know). So we need to start her up. All you have to do is open it's config file and change one setting (there are comments in the file to indicate what to do):

sudo pico /etc/default/memcached

Now you will be able to edit the file. Set ENABLE_MEMCACHED=yes

Finally start memcached:

sudo /etc/init.d/memcached start

Now you should be able to cache! Also one final note. The default port should be 11211.