XDebug: how to debug remote console application?

Short answer:

We need to set 2 environment variables, these two lines:

export PHP_IDE_CONFIG="serverName={SERVER NAME IN PHP STORM}"
export XDEBUG_CONFIG="remote_host=$(echo $SSH_CLIENT | awk '{print $1}') idekey=PHPSTORM"

Updated: Good IDE (e.g. PhpStorm) will do it for you, just set PHP interpreter to remote one.


Thanks to @DmitryR for the answer!

But, to avoid exporting XDEBUG_CONFIG each time I open my console, I've added second line (it was enough for me) to my

~/.bashrc file

export XDEBUG_CONFIG="remote_host=$(echo $SSH_CLIENT | awk '{print $1}') idekey=PHPSTORM"