How to debug PHP? [closed]
Anyone's been trying himself at object oriented programming ? Most probably every developer I guess:D I for one have never studied OO design patterns thoroughly, and trying to put it all together now does prove at times thrilling, and many times frustrating also. Even more so when trying to do it in : PHP开发者_如何学运维!
All-in-all, my boss asked me to add some Database persistence functions to her server, but most of all, she asked me to translate her already working procedural code into a working Object Oriented code.
Here I am, still standing on my PHP OO project. I'm (already) fed up with this "file logging only" PHP capability. I believe there must be some (free or not too much expansive) PHP debugging utility ? I've heard about Zend Studio and PHPEd so far, which didn't quite do the trick for whatever reasons. WIRCW("Which I don't Remember Correctly Why" lol)
What say yé? on debugging PHP ? Is there a tool that provides a good debug mode? what's more, don't forget I'm not speaking about the classical web Request/response model. Talking about a debugging facility which can enable you to trigger a web service (aka client request) and go into debug mode on the SOAP web service side.
Thks for any input.
You won't be able to debug a SOAP service locally really. You'd have to build a SOAP class and catch the errors there, based on response codes from your web service.
In your specific case I would probably var_dump()
the return response from the service and see what's happened there, or use something like SoapUI http://www.soapui.org/ to test my queries.
As for converting procedural code to object code, I would try and break up the logic into chunks and then create classes based around the actual data you're dealing with. So stuff dealing with users would end up in a User
class and similar.
As for debugging software, I would probably recommend XDebug as it cab be pretty handy. I would also recommend just turning on display_errors
and setting error_reporting to E_ALL
or strict.
This is a nice article on PHP debugging techniques:
http://www.ibm.com/developerworks/library/os-debug/
There are enough PHP debuggers out there:
- Xdebug
- Zend Debugger
I'm sure there are more. They offer the typical debugging features (stepping, watches, ..) andare best used with an IDE like Netbeans or Eclipse.
精彩评论