how we do basic debugging in PHP ?
Can anybody share true horror story on debugging PHP application (or (even better) on PHP framework such Codeigniter and WordPress) ?
i love to hear real experience in case i have to encounter similar situation on my journey to learn PHP.
XDebug may be used to debug a PHP application. Basically you install this on your server and configure it in PHP.ini. Then on your desktop machine, you can setup Netbeans (and maybe Eclipse, but I have not tried that) to remote debug. When you are in a remote debug session you can do any of the things you typically expect: set breakpoints, step through code, etc.
One major annoyance when using CodeIgniter with mod_rewrite is that the debugger gets confused by index.php not showing up in the URL. I am not sure if this is a problem on the client side or server, and whether CI “eating” the GET portion of a URL has anything to do with it. In any case, I have worked through it by copying a ‘debug.php’ file to the server and starting debugging with that file – everything seems to work fine after that.
I any case, I highly recommend you get setup with XDebug at some point. You may not use it everyday, but when you need it you’ll be thankful you did your homework ahead of time.
Easiest option (without installing any IDE) is to use firefox FirePHP addon.
There is one problem in using IDE debugers – it’s bad for debuging AJAX applications. In this case you will need to use some of browser extension. For FireFox it’s FirePHP, and gor Google Chrome it’s Php console.
I checked out a lot of debuggers 2 years ago when I wanted to set up a debugging environment for myself in PHP. I posted a brief post on this, you can go through it http://forums.codewalkers.com/general-chat-93/which-php-ide-to-use-840352.html
Bottomline was that Nusphere’s phped was the best and its debugbreak() function makes debugging a real bliss. With codeigniter also this works fine, no tweaks required if you have already enabled get variable. The only hiccup with codeigniter+phed is that, you cannot do code navigation like “right click and find declaration” for other files models.
Off late I have been checking out codelobster they have a codeigniter plugin, but I am not through with it yet.