#!/bin/bash
#This script is only applicable if you installed xampp 5.6.32 from this link https://www.apachefriends.org/download.html
#this is script has to be run only once
apt-get update -y
#install memcached cache server
apt install memcached
sudo apt-get update
#downloading required packages for compiling memcache extension of php
sudo apt-get install build-essential libtool autoconf unzip wge
export PHP_AUTOCONF=/usr/bin/autoconf
export PHP_PREFIX=/opt/lampp/bin/php
#Download memcache
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar -zxf memcache-2.2.7.tgz
cd memcache-2.2.7
/opt/lampp/bin/phpize
./configure --enable-memcache --with-zlib-dir=/opt/lampp --with-php-config=/opt/lampp/bin/php-config
make
make install
make test
# append to php.ini
echo "extension=memcache.so" >> /opt/lampp/etc/php.ini
/opt/lampp/ctlscript.sh restart apache