skaterdav85 Posted June 6, 2009 Share Posted June 6, 2009 Can you use the @ symbol in front of any function that may report errors in order to suppress them? When is it good to suppress errors and when to not? Link to comment Share on other sites More sharing options...
Natechs Posted June 6, 2009 Share Posted June 6, 2009 Yes you can. It is a good idea when using a MySQL command so people don't see the location of your database. Link to comment Share on other sites More sharing options...
jlhaslip Posted June 7, 2009 Share Posted June 7, 2009 In my humble opinion, the @ error-suppression method is a hack. You would be better served to find an error-handling method that suppresses the errors displayed to the site, but notifies you (the site Admin) by email. That way the client never sees the info as per the previous reply, yet you are notified of the error. As Site Admin, you need to know if/when errors happen in order to fix them. There is a good error-handler function in a book by Larry Ullman titled Php 5 Advanced, second edition. Chapter 2. ISBN : 0-321-37601-3. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 8, 2009 Share Posted June 8, 2009 For production sites it's a good idea to use error logging instead of displaying errors to the screen, that way if people are reporting errors you can just check the error log to see what's happening. I never suppress errors, if an error happens I want to know about it.error_reporting(E_ALL);ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log');ini_set('html_errors', 0);ini_set('log_errors', 1);ini_set('display_errors', 0);That will log all errors and put them in a file called error.log in the same directory as the script. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.