NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Debug a PHP CLI script forked from a web script by popen()


Joined: 14 Dec 2004
Posts: 21
Reply with quote
Hello,

I have written a PHP web application that uses popen() to fork a PHP CLI script that does some async background processing.

My problem is that I do not find a way to debug the CLI script in the context of the web application.
I have set the project run mode to "3rd Party Webserver" (using Apache on Win), but for the CLI script I would probably need the PHP CLI setting. But this would not allow me to use and debug the web based part of my system. I cannot call the CLI script on its own as it receives complex pipe input from the web part.
I also tried to use DebugBreak() within my CLI script, but it won't fire up the debugger.

Is there a solution for this mixed environment situation?

Cheers, Jörg.
View user's profileFind all posts by DigiLogSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
DebugBreak will certainly fire up the debugger.
What you need is to point out where the debugger is.
For example if you run php on one machine while IDE (with debugger) is on another - how would they find each other?
This is what DebugBreak() argument (the debugger request) is for.
In trivial case when they run on the same machine, the request is very simple: DebugBreak('1@localhost')
Please read FAQ for further details on syntax of the debugger requests.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Dec 2004
Posts: 21
Reply with quote
Hi Dmitri,

thanks for pointing me into the right direction. Using DebugBreak() with a debug session parameter works!
Although it did not work for me using "1@localhost". I had to explicitly use "1@127.0.0.1".
Could this be the result of my Win 7 machine using IPv6 in our internal network? If I ping localhost it resolves to ::1:, not to 127.0.0.1.
DebugBreak("1@::1:"); does not work either.

Cheers, Jörg.
View user's profileFind all posts by DigiLogSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
all variants below will work:

"1@localhost"
"1@[::1]"
"1@127.0.0.1"

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Dec 2004
Posts: 21
Reply with quote
Sorry Dmitri, I tested again and of your three options only "1@127.0.0.1" works.
I am using the latest PhpED (6.2 build 6233) and debugger (4.2.11 VC9 Threadsafe).

Cheers, Jörg.
View user's profileFind all posts by DigiLogSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Don't be sorry, but check you machine.
Localhost shouldn't be anything else but 127.0.0.1 or ::1
depending on ipv6 status.
If [::1] doesn't work for you, it means that ipv6 is not installed or not routed through ipv4.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Dec 2004
Posts: 21
Reply with quote
Quote:
Don't be sorry, but check you machine.

I am only trying to be polite. And I know my machine pretty well - as I said IPv6 is active:



Could the problem results from the fact that my project is not using localhost as the local web address? Instead it uses a faked local domain (e.g. myproject.mydomain.loc) that is set up in C:\Windows\System32\drivers\etc\hosts as:

Code:
127.0.0.1       myproject.mydomain.loc

???

Thanks for your help.
Cheers, Jörg.
View user's profileFind all posts by DigiLogSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
oh, that's funny, indeed!

you removed localhost from your system then tell me localhost does not work Smile

BTW if you return localhost back, you'll see "1@localhost" working too:

Code:
127.0.0.1       localhost myproject.mydomain.loc


as of remaining DebugBreak('1@[::1]'), it is supposed to work fine too and in fact works fine in my case. If it does not work for you, check debugger version. Anything older than 4.2.11 should be updated to this version (which is the latest at the moment) .

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Debug a PHP CLI script forked from a web script by popen()
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