Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XDebug: how to debug remote console application?

I have read this docs: http://xdebug.org/docs/remote

I can debug my web application.
But the debugger doesn't launch for console command.

My .ini file for XDebug (it works):

$ cat /etc/php5/fpm/conf.d/xdebug.ini
zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.idekey="PHPSTORM"
xdebug.remote_connect_back=1
xdebug.remote_enable=1

.ini file for cli is the same.

Also I tried to add export XDEBUG_CONFIG="idekey=PHPSTORM remote_enable=1 remote_connect_back=1" before debugging, but it didn't help.

How can I enable it?

like image 607
Dmitry Avatar asked May 13 '13 09:05

Dmitry


1 Answers

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.

like image 198
Dmitry Avatar answered Nov 10 '22 13:11

Dmitry