Skip to content

Instantly share code, notes, and snippets.

@gopalindians
Forked from hollodotme/Install-php7.md
Created February 7, 2016 00:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gopalindians/f1271a83fdc883fb3918 to your computer and use it in GitHub Desktop.
Save gopalindians/f1271a83fdc883fb3918 to your computer and use it in GitHub Desktop.
Installing php7-fpm with phpredis extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php-7.0
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
apt-get install php7.0-fpm php7.0-cli php7.0-common php7.0-json php7.0-opcache  php7.0-mysql php7.0-phpdbg php7.0-dbg php7.0-gd php7.0-imap php7.0-ldap php7.0-pgsql php7.0-pspell php7.0-recode php7.0-snmp php7.0-tidy php7.0-dev php7.0-intl php7.0-gd php7.0-curl

Build phpredis extension

git clone https://github.com/phpredis/phpredis.git
cd phpredis
git checkout php7
phpize
./configure
make && make install
cd ..
rm -rf phpredis

Activate phpredis extension in fpm and cli

echo "extension=redis.so" > /etc/php/mods-available/redis.ini

ln -sf /etc/php/mods-available/redis.ini /etc/php/7.0/fpm/conf.d/20-redis.ini

ln -sf /etc/php/mods-available/redis.ini /etc/php/7.0/cli/conf.d/20-redis.ini

service php7.0-fpm restart

nginx vhost config

Replace unix:/var/run/php5-fpm.sock with unix:/var/run/php/php7.0-fpm.sock

service nginx restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment