Re: PHP newbie: I love it, but...
| From: | Richard Lynch | Date: | Sat, 10 May 2003 22:14:27 +0000 |
| Subject: | Re: PHP newbie: I love it, but... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147150@lists.php.net to get a copy of this message | ||
Jean wrote:
> PHP is a very nice language. Been about a week reading O'Reilly & writing
> my first program. Making some fast progress. But, as I embellish my
> program, I am beginning to run into trouble. I am finding PHP to be
> extremely difficult to debug. There's a limit to embedding echo to check
> the program flow. Then, there are times when the browser shows absolutely
> nothing. Browser's Show Source Code lists next to nothing; I assume this is
> because the interpreter hung on a missing brace or something and outputted
> nothing! Until I become good at spotting my errors, I've got to find a
> debugging tool. Any words of wisdom would be appreciated.
I frequently find that http://php.net/errorlog works very well
when I
don't want to use echo.
Also be sure you use things like:
if (1){
echo "Debug message<BR>\n";
}
and then change the 1 to 0 to get rid of your messages.
And then back to 1 when you figure out you didn't really fix the bug.
Another option would be to get a decent editor that color-codes your
source.
Actually most any programmer's editor will do it with the right plug-in.
There's a web-site in the UK somewhere listing all the PHP
editors/debuggers with editorial comments...
For hard-core debugging, you could try Zend Debugger ($$$) Komodo
($$$) PHP Edit (?) or, err, that other PHP debugger I always forget
about...
I've never really gotten into any of them heavily, since echo/errorlog
work just fine for me. But I guess I cut my teeth back when debuggers
didn't really exist, so maybe I'm just an old fart.