NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
How to use DBGSESSID


Joined: 30 Apr 2009
Posts: 8
Reply with quote
I have the following code which is a small part of a very large project.

Code:

$url= JURI::root() . "geo/api.php?zipcode=" . $postal_code . "?DBGSESSID=1@clienthost:7869:d=1";
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_TIMEOUT, 3);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$data=curl_exec($curl_handle);
curl_close($curl_handle);
$data=json_decode($data);


Notice on the first line I added the ?DBG...

When I run the application in the debugger everything works great until I come to the curl_exec line. I think I don't understand how to use the DBGSESSID. How do I have the debugger work for the curl call? I am new to all of this, so the more detail the better.

I have read everything I can find about DBGSESSID but can't seem to make it work. Should DBGSESSID be set from the top level calling program, if so how do I do that, and then use the same in on the first line above? Or should I just spawn a new debug session as I am doing here. The thing is the new session, 1, as indicated above, never starts.

I think I am missing something.

Thanks in advance!

Paul.
View user's profileFind all posts by parisiSend private messageAIM AddressYahoo MessengerMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
"clienthost" tells the debugger to find the HTTP request origin (IP Address) and connect back to this host. Normally the requests are sent by your machine and therefore IP Address matches the address where you run PhpED. In case of inter-server communications all three machines (server A, server B and PhpED's) can be different.
So you have to use either real IP of your client machine, or localhost if you use SSH tunnel to server B.

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


Joined: 30 Apr 2009
Posts: 8
Reply with quote
I changed it to localhost and it still does not work. The debugger does not go into the cURL line.
View user's profileFind all posts by parisiSend private messageAIM AddressYahoo MessengerMSN Messenger


Joined: 30 Apr 2009
Posts: 8
Reply with quote
Just so we are clear here is the current code I am trying:

$url= JURI::root() . "geof/api.php?zipcode=" . $postal_code . "?DBGSESSID=99@127.0.0.1:7869:d=1";
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_TIMEOUT, 3);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$data=curl_exec($curl_handle);
curl_close($curl_handle);
$data=json_decode($data);

I changed the IP address and I changed the session ID to 99 thinking that might help.

I put a breakpoint on $data=curl_exec($curl_handle); and then press F7 and the debugger just goes to the next line. It takes a couple of seconds, so it is running the code, I just cannot see it in the debugger. I am using an SSH tunnel.

Please HELP.

Thanks,
Paul.
View user's profileFind all posts by parisiSend private messageAIM AddressYahoo MessengerMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
changing IP address to an arbitrary one does never help until you use right address.
In case of "localhost" or "127.0.0.1" it would work if
a) you are running PhpED on the same host with that (remote) server pointed by JURI::root() or you have SSH tunnel between that server and your machine where you run phped
b) you have php debugger installed on that web server
c) you have php debugger properly configured (allowed outgoing connections) on that web server

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


Joined: 30 Apr 2009
Posts: 8
Reply with quote
This is SO frustrating. I have been trying to get an simple answer for almost a week. I used the "official" support form and no response. I have had this product for years and kept support for years and have been very happy with it.

I said I was using a tunnel.
I said that debugging was working fine.
I said i was having an issue only when calling curl.

Please help. I have a urgent need to debug this one last thing that is preventing me from going live. Now I have to wait another two days.

Again, I am VERY frustrated with this.

Paul.
View user's profileFind all posts by parisiSend private messageAIM AddressYahoo MessengerMSN Messenger
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
Just something I noticed.

You have:

Code:
$url= JURI::root() . "geof/api.php?zipcode=" . $postal_code . "?DBGSESSID=99@127.0.0.1:7869:d=1";


Should that be:

Code:
$url= JURI::root() . "geof/api.php?zipcode=" . $postal_code . "&DBGSESSID=99@127.0.0.1:7869:d=1";


So you have & before DBGSESSID because it is an additional query parameter.
View user's profileFind all posts by plugnplaySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
You can check your 2nd server using Project settings Wizard - just create a new project for it and go through all the steps.

Alternatively you can check the tunnel by running
telnet 127.0.0.1 7869
on that server.
DbgListener should see incoming connection.
If it does not react at all, something goes wrong either on the server side, or on your client machine.
Check - port numbers (ddi you configure listener for 7869 port?), check firewalls, check tunnel direction and so forth.
If connection goes through telnet but still does not go through web server, check application-level security. Under windows it's controlled by firewall (3rd party and built-in), under Linux it's controlled by Linux SE. Enabled logs and check them after an attempt to establish connection.

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


Joined: 30 Apr 2009
Posts: 8
Reply with quote
The answer you gave seems to be related to the debugging not working at all.

It is working fine as I keep saying - however it just does not work in the cURL statement.

Please HELP!


Last edited by parisi on Mon Apr 02, 2012 7:07 pm; edited 1 time in total
View user's profileFind all posts by parisiSend private messageAIM AddressYahoo MessengerMSN Messenger
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
Have you fixed your query parameter string?

Is the server (both the page and the api.php) on the same server and is that server localhost?

Have you considered using DebugBreak() in api.php to force a breakpoint?

Bear in mind that when api.php runs, if it activates the debugger then depending on your PhpED settings it may run as a session in the background.
View user's profileFind all posts by plugnplaySend private message


Joined: 30 Apr 2009
Posts: 8
Reply with quote
That was it --- it was using a ? rather than a &.

Thank you so very much!

FYI - the code was on the same server. Also, I did try to use the DebugBreak but that did not do anything.

In any event - this is now working as expected. Again - thank you so very very much for you help!
View user's profileFind all posts by parisiSend private messageAIM AddressYahoo MessengerMSN Messenger
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
DebugBreak would work fine if you used DBGSESSID's value as an argument:
DebugBreak('99@127.0.0.1:7869:d=1');
otherwise it tries to connect back at the address found in REMOTE_ADDR which is the 1st server's address in your case and it's not where you run PhpED, right?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
How to use DBGSESSID
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