Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
bash script to install memcache on AWS lightsail LAMP stack (Mar 2017)
#install memcache on AWS lightsail bitnami
#memcache (no "d") is handy for cross platform testing as it will work on windows
#WAMP etc. where the memcached version does not appear to have a windows port)
#(lightsail lamp has the build environment gcc etc. already installed)
#memcache version
cd /root/bitnami
tar -zxf memcache-${VERSION}.tgz
export PHP_AUTOCONF=/usr/bin/autoconf
export PHP_PREFIX=/opt/bitnami/php
cd memcache-${VERSION}
./configure --enable-memcache --with-zlib-dir=/opt/bitnami/common
sudo make install
cd ..
rm -rf memcache-${VERSION}
rm memcache-${VERSION}.tgz
sudo perl -pi -e 's/^;' /opt/bitnami/php/etc/php.ini
#install the memcached daemon (defaults are ok for testing -m 64 -p 11211 -u memcache -l
sudo apt-get install memcached
sudo /etc/init.d/memcached start
#don't forget to restart fpm or you will go nuts chasing why it doesn't work...
sudo /opt/bitnami/ restart apache
sudo /opt/bitnami/ restart php-fpm
#In php:
#$memcacheObj = new Memcache;
#$memcacheObj->addServer('', 11211);
#...and you are off to the races
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment