Home > Archive > PHP Language > July 2004 > How do I debug?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| jdoe@youknowit.com 2004-07-22, 3:56 pm |
| I just installed Sokkit and have been teaching myself PHP.
Doing ok, except for the fact that when I have an error in my code, my
webpage comes up blank. No error messages. Show errors is turned on
in the php config file. How do I find out what's wrong with my code?
I've seen some IDE's that provide debugging, but after a trail you
have to fork over some cash for them and I'm only doing this for fun,
not professionally. Surely there is some kind of debugger/error codes
for php?
Any suggestions would be greatly appreciated.
Jason
| |
| Virgil Green 2004-07-22, 3:56 pm |
| <jdoe@youknowit.com> wrote in message
news:8fgvf0dq7el3vaggardapuuho0et1r9uaf@
4ax.com...
> I just installed Sokkit and have been teaching myself PHP.
>
> Doing ok, except for the fact that when I have an error in my code, my
> webpage comes up blank. No error messages. Show errors is turned on
> in the php config file. How do I find out what's wrong with my code?
>
> I've seen some IDE's that provide debugging, but after a trail you
> have to fork over some cash for them and I'm only doing this for fun,
> not professionally. Surely there is some kind of debugger/error codes
> for php?
>
> Any suggestions would be greatly appreciated.
echo() and die() are your friends.
- Virgil
| |
| Sebastian Lauwers 2004-07-22, 3:56 pm |
| jdoe@youknowit.com wrote:
> I just installed Sokkit and have been teaching myself PHP.
You know, tutorials aren't that bad they used to be... Well, some of them...
> I've seen some IDE's that provide debugging, but after a trail you
> have to fork over some cash for them and I'm only doing this for fun,
> not professionally. Surely there is some kind of debugger/error codes
> for php?
Zend is quite good, personnal copy is free.
>
> Any suggestions would be greatly appreciated.
Are you actually writing something on screen?
Did you check the Page Source that your browser gets?
> Jason
HTH,
Sebastian
--
The most likely way for the world to be destroyed,
most experts agree, is by accident.
That's where we come in; we're computer professionals.
We cause accidents.
--Nathaniel Borenstein
| |
| jdoe@youknowit.com 2004-07-22, 3:56 pm |
| On Thu, 22 Jul 2004 16:57:35 +0200, Sebastian Lauwers
<dacrashanddie@9online.fr> wrote:
>jdoe@youknowit.com wrote:
>
>
>You know, tutorials aren't that bad they used to be... Well, some of them...
I have a book/tutorials, which help, but it's seeing the errors I make
that i'm having a problem with
>
>
>Zend is quite good, personnal copy is free.
I'll download Zend now. Thanks.
>
>
>Are you actually writing something on screen?
>Did you check the Page Source that your browser gets?
>
The specific area I was working on was a small number of lines of PHP
inside HTML. Whenever there is a problem with the PHP I've written,
NO HTML page is generated at all. When I do it correctly, the page
generates. I was just hoping that when I screwed something up, an
error would display within the html. I had no idea where to
specifically look for the problem. Even if I had die() or echo()
statements, they wouldn't generate if something else was wrong (for
example, if I leave a ; off somewhere - the whole thing bombs)
>
>HTH,
>Sebastian
| |
| Colin McKinnon 2004-07-22, 3:56 pm |
| Virgil Green spilled the following:
> <jdoe@youknowit.com> wrote in message
> news:8fgvf0dq7el3vaggardapuuho0et1r9uaf@
4ax.com...
>
> echo() and die() are your friends.
>
.....but they can create some problems. Zend is good if you like IDEs. I
don't, but I suspect that I may purchase some licenses for work.
I'd recommend reading up on how to write your own error handler function in
PHP (http://www.php.net/manual/en/ref.errorfunc.php).
What I do is keep appending to a global variable, and output it at the end
of the script to the browser or email it using a function registered with
register_shutdown_function kinda like:
<?php
function when_done()
{
global $statuslog;
mail("me@localhost", $GLOBALS['PHP_SELF'], $statuslog);
}
$statuslog="Started\n";
register_shutdown_function('when_done');
.....
$statuslog.="Loaded include/require files\n";
.....
$statuslog.="Connected to database\n";
print "Progress so far = <pre>$statuslog</pre>\n";
....
HTH
C.
|
|
|
|
|