Note: Please go to to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > FAQs > How do I install memcached client for PHP?

How do I install memcached client for PHP?

Table of Contents



For Ubuntu just add the php5-memcache package and reload apache.

For CentOS,  install the package via PECL. This can be done using the Chef recipes included in the PECL Demo ServerTemplate.

Another option is to create a RightScript that will do this at launch time. The RightScript should contain the following:

#!/bin/bash -ex

# Test for a reboot,  if this is a reboot just skip this script.
if test "$RS_REBOOT" = "true" ; then
  echo "Skip install of PECL::Memcache on reboot."
  logger -t InstallPHPMemcacheScript "Skip Example script on reboot."
  exit 0 # Leave with a smile ...

echo "Installing PECL::Memcache"
echo "y" | pecl install -a -f memcache
if [ $? -eq '0' ]; then
  echo "install completed successfully adding to php.conf"
  echo "" > /etc/php.d/memcache.ini

exit 0

Add this RightScript to the boot scripts for your server template and ensure that Apache 2 is restarted after.

You must to post a comment.
Last modified
16:15, 17 Jun 2013



This page has no classifications.



© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.