For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > December 2004 > Use of @ (was interpreting error messages from include files...)









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]

 

Author Use of @ (was interpreting error messages from include files...)
Dani CS

2004-12-31, 3:55 pm

JAS wrote:
> r6uji7@gmail.com wrote:
>
>
>
> I prevents an error message being displayed if one should happen. I
> always use it with mysql, mail, cookie, and similar functions and trap
> errors rather than just letting my app crap out displaying errors that
> might compremize the application to the public.



There is another way to avoid showing errors to the public, and I think
it's better:

<quote src="http://es2.php.net/manual/en/security.errors.php">

A better option is not to disable error reporting, but just not showing
them, and let them log to a file.

For example, set in your php.ini file:
log_errors on
display_errors off
error_log /var/log/php_errors

</quote>


This way you can still see the errors, not in the client window but
rather in a private file local to the server. When there's need to
debug, you see the real errors as they happened , instead of having to
edit the source code to let them show and then reproduce them.

Obviously, trapping errors when they happen is the best thing to do, but
it's very difficult to catch 'em all.
JAS

2004-12-31, 3:55 pm

Dani CS wrote:
> JAS wrote:
>
>
>
>
> There is another way to avoid showing errors to the public, and I think
> it's better:
>
> <quote src="http://es2.php.net/manual/en/security.errors.php">
>
> A better option is not to disable error reporting, but just not showing
> them, and let them log to a file.
>
> For example, set in your php.ini file:
> log_errors on
> display_errors off
> error_log /var/log/php_errors
>
> </quote>
>
>
> This way you can still see the errors, not in the client window but
> rather in a private file local to the server. When there's need to
> debug, you see the real errors as they happened , instead of having to
> edit the source code to let them show and then reproduce them.
>
> Obviously, trapping errors when they happen is the best thing to do, but
> it's very difficult to catch 'em all.


Yah I totally agree -- I just use them for those few that I are most
likely to occur and are easily trappable @mysql_connect .... or die ...

J
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com