Skip to content

Instantly share code, notes, and snippets.

@iJackUA
Last active April 9, 2016 05:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save iJackUA/7140430 to your computer and use it in GitHub Desktop.
Save iJackUA/7140430 to your computer and use it in GitHub Desktop.
Install php_redis extension from source (Ubuntu)
#!/bin/bash
if [ "$(whoami)" != "root" ]; then
echo "ERROR : Run script as Root (sudo !!) please"
exit 1
fi
read -e -p "php_redis version to be installed (change if needed) : " -i "2.2.4" VERSION
echo 'Installing php_redis v.'$VERSION' ... '
# installing build essentials if it is missing
apt-get install php5-dev php-pear
wget https://github.com/nicolasff/phpredis/archive/$VERSION.tar.gz
tar xzf $VERSION.tar.gz
cd phpredis-$VERSION
phpize
./configure
make
make install
cd ..
rm phpredis-$VERSION -R
rm $VERSION.tar.gz
mv /etc/php5/mods-available/redis.ini /etc/php5/mods-available/redis.bkp
touch /etc/php5/mods-available/redis.ini
echo "extension=redis.so" > /etc/php5/mods-available/redis.ini
ln -s /etc/php5/mods-available/redis.ini /etc/php5/apache2/conf.d/redis.ini
ln -s /etc/php5/mods-available/redis.ini /etc/php5/cli/conf.d/redis.ini
service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment