First of all you have to install the xdebug package for PHP 5.6
sudo apt-get install php-xdebug
Then you have to enable it so it is accessible from PhpStorm for example
Edit the file
sudo nano /etc/php/5.6/mods-available/xdebug.ini
and add the following lines
xdebug.remote_enable xdebug.remote_connect_back xdebug.idekey - "vagrant"
The PHP service needs to be restarted
sudo service php5.6-fpm restart
To check if everything is fine
php -v
PHP 5.6.31-1-ubuntu14.04.1-deb.sury.org-1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans