Cannot trace source or set breakpoints on php scripts?

Is it possible to debug simple command line type PHP scripts?  My debugging of large web apps seems to work fine but for the life of me I cannot get proper debugging (breakpoints or stepping through source code) to work with a simple 3 line command line PHP script.

When I start the script on the remote server it connects up to PHP storm which has been listening just fine.  PHP Storm is set to break on first line and so it does break and I see variables I can examine which are correct and from my script.  However the source code for the PHP file does not hi light to indicate which line the script stopped on.  Clicking the various step over/into options does appear to be debugging but again the source code window does not track.  The correct script filename and line number are shown in the "Frames" area, however.  Finally, if I set a breakpoint in the script the breakpoint is ignored.

I can continue to (blindly) step through the script and its runs to completion.  This is an extremely annoying way to debug and of limited usefulness on a larger script.

Is debugging of such scripts supported?  Or is the debugging only supposed to work with web based applications (lots of references to URLs and web servers in the project settings -- not sure what to do here if its not a web project), etc etc?

-A

 





2 comments

Hi there,

>Is debugging of such scripts supported? 

Sure -- quite common scenario (see https://youtrack.jetbrains.com/issue/WI-7906 for original ticket and what needs to be done; also http://blog.jetbrains.com/webide/2012/03/new-in-4-0-easier-debugging-of-remote-php-command-line-scripts/). So far it could be missing host name or some mismatching path.

BTW -- instead of initiating your debugging from remote.. why not try SSH based approach (you can initiate it right from IDE -- it will connect and execute script remotely with all needed parameters (PHP Remote Interpreter is required here))

If nothing -- please collect xdebug log as well as log from IDE side -- need to see what they have to say about all of this.

 

P.S. Not sure .. but could be related to https://youtrack.jetbrains.com/issue/WI-18808

P.P.S. Do you have "PHP | Servers" setup for this?

P.P.P.S. What will happen if you disable "Break on first line..." options in "PHP | Debug" ?

0

Hello,

You can also try to configure a remote PHP interpreter and then use it in PHP Script Run configuration.

0

Please sign in to leave a comment.