‹‹ Go to homepage

Debug PHP Cli with Xdebug and PhpStorm

06 of November, 2013


PhpStorm is well known for it’s zero-configuration web application debugging using Xdebug. And it works just fine with remote hosts as well. However, debugging of php command line code on remote host is not that straight forward.

But it’s not that hard as well. Basically, we have to set up couple of environment environment variables. One is Xdebug configuration of remote host with IDE, another - IDE configuration with server name, where script is running:

# specify remote host IP address (where IDE is running) -> 192.168.33.1
export XDEBUG_CONFIG="idekey=session_name remote_host=192.168.33.1 profiler_enable=1"

# specify server name -> project.development.local
export PHP_IDE_CONFIG="serverName=project.development.local"

To terminate debugging session it’s only required to unset these two variables:

unset XDEBUG_CONFIG
unset PHP_IDE_CONFIG
comments powered by Disqus