NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Help with debugging RESTful web services using Slim Framewor


Joined: 14 Oct 2015
Posts: 2
Reply with quote
Hi All,

Is there a single point of truth that one can visit that explains in point form (step by step). How to take a php file running as a restful web service on LOCALHOST and debug it?

I have waded through all the Debugging links and just can't seem to get anything to work.

I an fine with GETs because I can run them of the URL. I have the SLIM framework installed and would really like to be able to debug the other HTTP verbs.

Would really appreciate some help with this.

Cheers
Tony Benci
View user's profileFind all posts by tbenci@live.comSend private message
Guru master

Joined: 24 Jul 2009
Posts: 710
Reply with quote
You could add DBGSESSID to your web request URL's but not always convenient.

Possibly you will find the PHP statement DebugBreak() useful. Because the API request may not be identifiable back to a specific computer with the debugger running, you may have to tell DebugBreak() which computer has the debugger:

Code:
// where 1 is the session ID and the value after the @ is your computer IP address
DebugBreak('1@192.168.1.50')


If you are debugging a service where it might be getting other connections that should not be debugged, you could use something like:

Code:
if ($_SERVER['REMOTE_ADDR'] == '192.168.1.50') {
    DebugBreak('1@192.168.1.50');
}


Note: Remember to not allow DebugBreak() to run on code in a live production environment. You can use a variety of methods to stop your debug code from running without having to remove it.

There is lots of info in this forum about DebugBreak() and the syntax of the parameter is the same as for DBGSESSID. See http://www.nusphere.com/kb/technicalfaq/faq_dbg_related.htm

After DebugBreak() has forced a breakpoint, your IDE breakpoints will also activate.
View user's profileFind all posts by plugnplaySend private message


Joined: 14 Oct 2015
Posts: 2
Reply with quote
Can't thank you enough for your response. Since I posted this I did the hard yards and yes Smile... read the bloody manual Smile... and this answer just rounded it all out for me.

Currently I have WEBSTORM running the front end (HTML/ANGULARJS) and PHPEd running the RESTful stuff on my local test server (127.0.0.1) and it all works together like peas in a pod.

I'm sure a lot of PHPEd users would be like me and just thank Nusphere every day for such a fine product. Wish they had a JS environment as well Smile

Regards
Tony
View user's profileFind all posts by tbenci@live.comSend private message
Help with debugging RESTful web services using Slim Framewor
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