Jump to content

Php Error Suppression With @


skaterdav85

Recommended Posts

is it a good idea to use the @ sign and suppress all potential errors when using mysqli functions when a site is live? If so, how do people go about doing this since im assuming you dont use the @ sign on all your mysqli functions during development?

Link to comment
Share on other sites

I never suppress errors. If a page is giving errors then it's broken and needs to be fixed. During development and on live sites, I instead prefer to redirect all errors to a file instead of displaying them. That way if people are reporting errors I can download the file to see the messages.

Link to comment
Share on other sites

is it a good idea to use the @ sign and suppress all potential errors when using mysqli functions when a site is live? If so, how do people go about doing this since im assuming you dont use the @ sign on all your mysqli functions during development?
Except when outputting image content, I don't see a reason to surpress errors. If they're there, you have to fix them. If they're not then there's nothing to hide to begin with.
Link to comment
Share on other sites

I never suppress errors. If a page is giving errors then it's broken and needs to be fixed. During development and on live sites, I instead prefer to redirect all errors to a file instead of displaying them. That way if people are reporting errors I can download the file to see the messages.
how do you do that? say you did this:mysqli_connect($dbc, $some_query);how would you redirect an error to another file? Does that other file save the errors or something?
Link to comment
Share on other sites

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 redirect all errors to a file called error.log in the same directory. Just make sure PHP has write permissions on the error log.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...