• OK, I’m building my own plugin. It’s still raw code & in fact not all of it has been written. I wanted to start debugging the code that has been written so far, so I did a little research.

    I’m testing this on my MacBook running MAMP. It has a copy of my web site from my host on it. I’m running WordPress MU 2.8.1 in both environments. I downloaded & installed XDebug & MacGDBp. I’m using Smultron for writing the code, but I can switch to another IDE if it’s better.

    Well, after clicking “Activate Site Wide”, the admin screen won’t even show display. Blank screen. When I move my plugin’s folder out of the wp-content/plugins folder, I get the admin screen back. So I know it’s my code that’s the problem. I just don’t know what I’m doing with the debugger.

    The debugger won’t let me open my source file, so I can’t set a break point. Almost everything under the File menu is grayed out.

    Any ideas?

    Thanks

    Tony

Viewing 4 replies - 1 through 4 (of 4 total)
  • turn on and/or use on php’s error reporting.

    https://www.php.net/errorfunc

    write some extra debugging. I have a 23 line debug function thats awesome, for instance.

    Thread Starter TonyVitabile

    (@tonyvitabile)

    Would you mind sharing that 23 line debug function?

    I can always write code that outputs messages as routines are entered & exited, and I will if I have to. I was just hoping to set a break point in my own source file & step through the code, the way I did with C, C++, Java, and even VB.

    One of the things I hated about debugging server side ASP was the lack of any way to control execution. I’m trying to avoid reliving that experience.

    Thanks

    Tony

    its just a variant of this which is even shorter,

    https://hexmen.com/blog/2007/05/php-debug-function/

    Thread Starter TonyVitabile

    (@tonyvitabile)

    I have managed to locate Eclipse with the PDT extensions for my Mac. I downloaded & installed this. After playing with everything, I can edit my code in Eclipse. This is way better than Smultron, as it locates the syntax & variable misspellings in my code. I’ve got all of that pretty much gone now, though there’s an issue with a file I’m not worried about right now.

    So my problem is I still can’t get the debugger to step in my code unless I start the plugin directly. This isn’t viable, as it needs all of the WordPress stuff. I’m at a loss as to how to start WordPress first when my plug in begins running. Should I add the WordPress folder as an external source folder?

    Anybody got any ideas?

    Tony

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How do I debug my plugin?’ is closed to new replies.