Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do Debugging of PHP?

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.

like image 326
justjoe Avatar asked Mar 14 '10 15:03

justjoe


People also ask

Can you Debug PHP in browser?

A: You can easily debug PHP in Chrome using a simple extension called PHP Console. Just install this PHP debugging tool from the Chrome web store and start logging errors, warnings, exceptions, and vars dump on your Chrome browser.

What is your most preferable approach while debugging PHP code?

The best and more user-friendly way of debugging most of the people prefer if they are using an IDE for coding is using XDebug. XDebug is a PHP extension that helps in the development and debugging and provides a single step debugger that you can use with an IDE like PHPStorm.

What is debugging process in PHP?

Xdebug is a PHP extension which provides debugging capabilities. It uses the DBGp debugging protocol. Xdebug is a PHP extension which provides debugging and profiling capabilities. It uses the DBGp debugging protocol. At this end this tool is responsible to enable the debugging on PHP, and Xcode takes advantage of it.


1 Answers

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.

like image 194
Justin Ethier Avatar answered Sep 27 '22 18:09

Justin Ethier