Entry
Is there a debugger available for PHP?
How can I debug PHP scripts?
Apr 22nd, 2005 06:48
Tom Carty, Linus McCabe, Nathan Wallace, hance zq, Brian Schaffner, Chris Carey
Most people just use echo() statements to figure out what's happening
and when.
If you wan't a visual debugger or more advanced tools, your options
depends on what version of PHP you are using.
For PHP4 and later, there are free alternatives like Gubed PHP Debugger,
http://gubed.sf.net , and XDebug, http://www.xdebug.org
A tutorial for Gubed PHP Debugger can be found here:
http://www.very-clever.com/quanta-gubed-debugging.php
Examples of commercial tools are DBG, http://dd.cron.ru/dbg/ , and Zend
Studio, http://www.zend.com/store/products/zend-studio.php .
For PHP3 there is an integrated debugger, but it is not really useful
for the basic debugging of scripts and it was removed in PHP4.
http://www.php.net/manual/debugger.php3
PHP's internal debugger is useful for tracking down evasive bugs. The
debugger works by connecting to a TCP port for every time PHP starts up.
All error messages from that request will be sent to this TCP
connection. This information is intended for "debugging server" that can
run inside an IDE or programmable editor (such as Emacs).
After getting a port setup and capturing output you still have to deal
with the output. Unfortunately, the PHP engine dumps everything and
it's mother to the port. Opening one moderately complicated page you
may receive about 1 Meg of debug text output -- it's a little bit of a
headache looking through this much material to track down a bug.