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.

Be Sociable, Share!

Related posts:

  1. Install PHP Pear Spreadsheet in Ubuntu and Mint
  2. Localhost Subdomains on Ubuntu
  3. Enabling Apache Sites and Modules in Ubuntu
  4. Creating Virtual Hosts in Ubuntu
  5. Send Mail Locally on Ubuntu