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./configuremake && make install
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