Created
March 14, 2017 08:41
-
-
Save nmcgann/4426251fe272addc1f2982dea197ae83 to your computer and use it in GitHub Desktop.
bash script to install memcache on AWS lightsail LAMP stack (Mar 2017)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#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 | |
VERSION='3.0.8' | |
cd /root/bitnami | |
wget http://pecl.php.net/get/memcache-${VERSION}.tgz | |
tar -zxf memcache-${VERSION}.tgz | |
export PHP_AUTOCONF=/usr/bin/autoconf | |
export PHP_PREFIX=/opt/bitnami/php | |
cd memcache-${VERSION} | |
/opt/bitnami/php/bin/phpize | |
./configure --enable-memcache --with-zlib-dir=/opt/bitnami/common | |
make | |
sudo make install | |
cd .. | |
rm -rf memcache-${VERSION} | |
rm memcache-${VERSION}.tgz | |
#enable | |
sudo perl -pi -e 's/^;extension=memcache.so/extension=memcache.so/' /opt/bitnami/php/etc/php.ini | |
#install the memcached daemon (defaults are ok for testing -m 64 -p 11211 -u memcache -l 127.0.0.1) | |
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/ctlscript.sh restart apache | |
sudo /opt/bitnami/ctlscript.sh restart php-fpm | |
#done | |
#In php: | |
#$memcacheObj = new Memcache; | |
#$memcacheObj->addServer('127.0.0.1', 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