Jump to content

Php Error Suppression With @


skaterdav85
 Share

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?

Edited by big dave
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.

Edited by justsomeguy
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...