# 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
# 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-mbstring 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 php7.0-zip php7.0-xml
As mentioned by @jackmcpickle php-redis can now be installed with apt-get install php-redis
and should be equivalent to the manual installation below. After installation phpinfo()
says: Redis-Version 2.2.8-devphp7
Same with xdebug. apt-get install php-xdebug
will install the newly released stable version 2.4.0 that has php7 support.
So the manual installations below are not needed any longer.
git clone https://github.com/phpredis/phpredis.git
cd phpredis
git checkout php7
phpize
./configure
make && make install
cd ..
rm -rf phpredis
echo "extension=redis.so" > /etc/php/7.0/mods-available/redis.ini
ln -sf /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/fpm/conf.d/20-redis.ini
ln -sf /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/cli/conf.d/20-redis.ini
service php7.0-fpm restart
Replace unix:/var/run/php5-fpm.sock
with unix:/var/run/php/php7.0-fpm.sock
service nginx restart
# Download stable release of xdebug 2.4.0
wget -c "http://xdebug.org/files/xdebug-2.4.0.tgz"
# Extract archive
tar -xf xdebug-2.4.0.tgz
cd xdebug-2.4.0/
# build extension
phpize
./configure
make && make install
Enable the extension:
echo "zend_extension=xdebug.so" > /etc/php/7.0/mods-available/xdebug.ini
ln -sf /etc/php/7.0/mods-available/xdebug.ini /etc/php/7.0/fpm/conf.d/20-xdebug.ini
ln -sf /etc/php/7.0/mods-available/xdebug.ini /etc/php/7.0/cli/conf.d/20-xdebug.ini
service php7.0-fpm restart
# Check it
php -m | grep -i xdebug
# should print:
xdebug
Xdebug
For activating Redis extension with Apache2, I also had to do
sudo ln -sf /etc/php/7.0/mods-available/redis.ini /etc/php/7.0/apache2/conf.d/20-redis.ini