如何使用xdebug调试PHP CLI脚本? [英] How can I debug a PHP CLI script with xdebug?
问题描述
我还没有想到这一点。我发现的每一个文档包括如何使用xdebug调试在Apache中运行的脚本。我需要调试一个php CLI脚本。
例如,如何传递XDEBUG_SESSION_START变量以获得xdebug启动?
我特意尝试调试CakePHP shell。因此,如果任何人有任何额外的洞察力,我会很感激。
谢谢。
在
而且调试配置
窗口:
希望这有助于: - )
否则,你遇到什么具体问题?
I haven't quite figured this out. EVERY piece of documentation I've found covers how to use xdebug to debug scripts running in Apache. I need to debug a php CLI script.
So, for instance, how do I pass the XDEBUG_SESSION_START variable in to get xdebug to kick on?
I'm specifically trying to debug a CakePHP shell. So if anyone has any additional insight into that I'd be very appreciative.
Thanks.
There is a couple of notes about that in Xdebug's manual, like, for instance (quoting) :
export XDEBUG_CONFIG="idekey=session_name"
php myscript.php
If you are using Eclipse PDT to develop and debug your PHP scripts, there is not much difference between Apache or CLI : the configuration lloks quite the same, you just don't have to configure a web server, nor indicate an URL ; instead, you have to indicate the path to the PHP executable.
About the XDEBUG_SESSION_START
variable : well, you launch the whole script in "debug-mode", so you don't have any notion of "debugging-session", I'd say.
For instance, here's what Window > Preference > PHP > PHP executables
looks like for me right now, and, on the right, what I get when clicking on the Edit
button of the first one :
And the debug configurations
window :
And launching the debugging: it just works :
Hope this helps :-)
Else, what specific problem do you encounter ?
这篇关于如何使用xdebug调试PHP CLI脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!