How can I debug a PHP CLI script with xdebug?(如何使用 xdebug 调试 PHP CLI 脚本?)
问题描述
我还没有完全弄清楚这一点.我找到的每篇文档都涵盖了如何使用 xdebug 调试在 Apache 中运行的脚本.我需要调试一个 php CLI 脚本.
那么,例如,我如何传递 XDEBUG_SESSION_START 变量以启动 xdebug?
我特别想调试 CakePHP shell.因此,如果有人对此有任何其他见解,我将不胜感激.
谢谢.
在
(来源:
(来源:
(来源:
(来源:pascal-martin.fr)
希望这会有所帮助:-)
否则,您遇到什么具体问题?
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 :
(source: pascal-martin.fr)
(source: pascal-martin.fr)
And the debug configurations
window :
(source: pascal-martin.fr)
And launching the debugging: it just works :
(source: pascal-martin.fr)
Hope this helps :-)
Else, what specific problem do you encounter ?
这篇关于如何使用 xdebug 调试 PHP CLI 脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 xdebug 调试 PHP CLI 脚本?


- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01