Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
663 views
in Technique[技术] by (71.8m points)

cakephp - How can I debug a PHP CLI script with xdebug?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 :

image
(source: pascal-martin.fr)
    image
(source: pascal-martin.fr)

And the debug configurations window :

image
(source: pascal-martin.fr)

And launching the debugging: it just works :

image
(source: pascal-martin.fr)


Hope this helps :-)

Else, what specific problem do you encounter ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...