Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Debugging:
For Your Eyes Only on PHPBuilder
Oct 21, 2002 @ 13:00:56

When you're first starting out, debugging can be a very tricky part of PHP. Some of the error messages just don't make sense, and half the time, it's just a missing semicolon or a forgotten bracket that causes the whole mess. Then, once you reach "perfection" for your scripts, you put them out there for the world to see where they'll work 100% of the time, right? Ha! If only. We all know that unexpected errors pop up in the strangest of places, users using your scripts in ways that you never even thought possible. So, now you're stuck with debugging a live site. What's the best way? Well, PHPBuilder.com has a few suggestions for you.

In Beginner Debugging: For Your Eyes Only they talk about using a static IP as a basis to tell who to show the debugging to and who to keep it from. They basically define an array of IPs that are the "allowed" IPs to show it all to. Then, when the script runs, all you have to do is enclose the debugging inside of if statements and, voila - instant "programmer only" debugging.

This is a pretty simple way to do it, and I've seen some other things that are a little bit more effective, but it gives you a good starting point. If this style isn't right for you or your application, you can always go and google around for some other alternatives.

tagged:

Link:


Trending Topics: