NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
How to run debugger from command prompt in Windows?


Joined: 03 Mar 2004
Posts: 40
Reply with quote
I'm trying to debug a script that needs to run in a DOS Command window on Windows XP. I have PHPed v4.5 Build 4513 and PHP DBG Listener, version 2.20.2. I inserted debugbreak() in my script, but when I run the script in the command window, it reports this error:
Code:
<html><body><h2>DBG 2.20.1</h2><br>
<b>Failed to run DBG session</b><br><br><br>
Reason: <b>client ip address [(null)] lookup failed</b><br>
Not sure what it means? Visit <a href="http://www.nusphere.com/dbg/">http://www.nusphere.com/dbg/</a> for troubleshooting.<br>
<br>
<pre>Debugger request:   "(null)"
Request found in:   "(null)"
Target PHP version: "5.1.2"
Server API:         "Command Line Interface"
Extensions API:     "220051025"
Modules API:        "20050922"
PHP API:            "20041225"
</pre>
</body></html>

The DBG Listener is running with these parameters:
Code:
Bind address:             <ALL ADDRESSES>
Port:                          7869
IDE COM class:          PhpED IDE ver 4.5
Code page:                Western European (Windows)
Breakpoint on script start
Breakpoint on script finish

I'd be happy to run the script from within PHPed (which works) but can't see a way to pass command line arguments to the script from within the IDE, like I can with GET, POST, COOKIE.

Also Dmitri said in an earlier post:
Quote:
Starting with this version 2.18 it's possible to trigger debug session using DBGSESSID in the command line.

It's probably not related to my current problem, but I can't figure out how to do that, and this doesn't seem to be documented anywhere. I'd rather do that than have to add debugbreak() to my scripts if I can't run the scripts from inside PHPed.

Can you point me to a solution?

Cheers,

Jon
View user's profileFind all posts by jonphippsSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
uncheck tools->settings->debugger->auto select host and specify localhost as hostname.
Alternatively, set debugger.JIT_host=localhost in php.ini (check path to php.ini in phpinfo output)
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 03 Mar 2004
Posts: 40
Reply with quote
Thanks Dmitri,
ddmitrie wrote:
uncheck tools->settings->debugger->auto select host and specify localhost as hostname.

This didn't make any difference Sad
ddmitrie wrote:
Alternatively, set debugger.JIT_host=localhost in php.ini (check path to php.ini in phpinfo output)

This worked. Thanks! Smile
But...
This means that in order to debug from the command line I need to alter php.ini and restart Apache every time or leave debugging in this way enabled all of the time. This is not so good, but it's ok if it needs debugbreak() to invoke the JIT debugger. Also, setting debugger.JIT_enabled=off or =on has no effect on this so I assume that debugbreak() invokes the JIT debugger regardless of the JIT_enabled setting?

I think the best thing would be for me to run the scripts from within PHPed and manually set the $argv array myself in the script. Especially since I have to alter the script to insert a debugbreak() anyway.

It would be ideal if there was a way to turn command line debugging on and off from PHPed, or a way to do it from the command line. You mentioned before that DBGSESSID could be used for this. Could you give me an example usage?

Cheers,

Jon
View user's profileFind all posts by jonphippsSend private message


Joined: 09 Dec 2003
Posts: 92
Reply with quote
Yeah, I would be interested too Smile

Right now I have to insert a debugBreak() at the beginning of the script and keep a DOS box open to run it... I also did not find a way to run it directly from PhpEd, activate the debugger and provide the argv[]s Smile.
View user's profileFind all posts by mpSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
JIT debugger is not used when it's off. It starts debug session if there an error in the code with level higher than specified. By default all warnings and errors will start debug session when JIT is enabled.

Regarding JIT host setting, it's just a last thing dbg tries when client host to start debugging with is not specified in the DBGSESSID and $_SERVER[REMOTE_ADDR] is not set. With command-line running it's the case.

right now you may try something like this
php.exe myscript.php DBGSESSID=1@localhost
View user's profileFind all posts by dmitriSend private messageVisit poster's website
How to run debugger from command prompt in Windows?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic