Professional Web Applications Themes

How do I debug? - PHP Development

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...

  1. #1

    Default How do I debug?

    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
    jdoe@youknowit.com Guest

  2. #2

    Default Re: How do I debug?

    <jdoeyouknowit.com> wrote in message
    news:8fgvf0dq7el3vaggardapuuho0et1r9uaf4ax.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


    Virgil Green Guest

  3. #3

    Default Re: How do I debug?

    [email]jdoeyouknowit.com[/email] 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
    Sebastian Lauwers Guest

  4. #4

    Default Re: How do I debug?

    On Thu, 22 Jul 2004 16:57:35 +0200, Sebastian Lauwers
    <dacrashanddie9online.fr> wrote:
    >jdoeyouknowit.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 have a book/tutorials, which help, but it's seeing the errors I make
    that i'm having a problem with
    >
    >> 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.
    I'll download Zend now. Thanks.
    >
    >>
    >> Any suggestions would be greatly appreciated.
    >
    >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 ed 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)
    >> Jason
    >
    >HTH,
    >Sebastian
    jdoe@youknowit.com Guest

  5. #5

    Default Re: How do I debug?

    Virgil Green spilled the following:
    > <jdoeyouknowit.com> wrote in message
    > news:8fgvf0dq7el3vaggardapuuho0et1r9uaf4ax.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.
    >
    .....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 ([url]http://www.php.net/manual/en/ref.errorfunc.php[/url]).

    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("melocalhost", $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.

    Colin McKinnon Guest

Similar Threads

  1. debug CF6/7
    By canyon2 in forum Macromedia ColdFusion
    Replies: 0
    Last Post: June 27th, 05:07 AM
  2. debug
    By ernest in forum Windows XP/2000/ME
    Replies: 1
    Last Post: July 19th, 11:00 PM
  3. Why can't I debug?
    By Andy Crawford in forum ASP.NET General
    Replies: 4
    Last Post: July 18th, 05:18 PM
  4. I can't debug!
    By Kyle in forum ASP.NET General
    Replies: 1
    Last Post: July 15th, 08:04 PM
  5. VB6 COM ASP DEBUG on XP
    By Mark Reichard in forum ASP Components
    Replies: 0
    Last Post: July 5th, 05:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139