Home » Script/Site Error Solving

Script/Site Error Solving

Here’s a little something that can work both as a security feature if enabled, and a debugging tool if disabled.

Anywhere you have include statements (especially your satellite index.php if using my method), you can use the @ symbol to determine if errors are output to the browser, or hidden (suppressed).

So for example, this:

< ? include ("somefile.html"); ?>

Would display all sorts of ugly errors if the file couldn’t be found, or if there was generally any problem with it.

However, this:

< ? @include ("somefile.html"); ?>

will NOT display any errors of any kind. What it WILL display depends a bit on your system, but the key thing is, no errors.

Why do we care? Well apart from the “obvious” of not showing ugly broken pages to our visitors, it also means that visitors won’t see the various filenames and paths involved in your script calls. In fact, this could hide the entire fact that it’s even a dynamic site. On my sites for example, if the entire site was UTTERLY broken and nothing could load, all the visitor would see now is what’s in my index.html file, which is:

ERROR 404_PAGE NOT FOUND

So it looks like a simple understandable error.

On the other hand, what if you’re trying to figure out why a module or something else isn’t loading, and you can’t figure it out because EVERYTHING looks fine, it just will NOT appear on your browser?

If working with NicheCreator, check the include statement at the bottom of index.php (this was pointed out by Philosopher in fact on the NC forum) and notice there is a @ symbol in the include statement. This basically says – “If any module has trouble, give up on it and don’t show any errors”. But that doesn’t help you to troubleshoot much does it? An error message is much preferred. SO… take out the @ symbol until you troubleshoot the problem, then put it back in just in case something breaks randomly some day and you don’t want your visitors seeing broken code.

I can’t tell you how many times I’ve gone to sites that had broken scripts, and by looking at the paths in the error messages, I find out all SORTS of interesting things the site owner probably didn’t want me to know about. 😉

Your helpful hint for the day… 🙂

Name of author

Name: macroking

Leave a Reply

Your email address will not be published. Required fields are marked *