XDebug:如何调试远程控制台应用程序? [英] XDebug: how to debug remote console application?

查看:90
本文介绍了XDebug:如何调试远程控制台应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了以下文档: http://xdebug.org/docs/remote

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

我可以调试我的Web应用程序.
但是调试器不会针对控制台命令启动.

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

我的用于XDebug的.ini文件(有效):

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文件是相同的.

.ini file for cli is the same.

我也尝试在调试之前添加export XDEBUG_CONFIG="idekey=PHPSTORM remote_enable=1 remote_connect_back=1",但这没有帮助.

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

如何启用它?

推荐答案

简短答案:

我们需要设置2个环境变量,这些两条行:

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"

已更新: 优秀的IDE(例如PhpStorm)将为您做到这一点,只需将PHP解释器设置为远程解释器即可.

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

这篇关于XDebug:如何调试远程控制台应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆