Jump to content

hide error messages from browser


mickstevens

Recommended Posts

I'm pretty new to php, and I'm making everything on my web site php-driven.

 

If a warning or error occurs, I don't want the user to see it. Primarily because some of the messages give away hidden file paths that I don't want anyone to know about.

 

I would prefer to redirect all warnings and errors to a log file. If that's not possible, I would like to just hide them.

 

I've googled and can't really find what I'm looking for. PHP.net's manual describes something called display_errors, which doesn't sound bad, but then it says:

 

"Note:

 

This is a feature to support your development and should never be used on production systems (e.g. systems connected to the internet). "

 

http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

 

And I read you can use the @ before any expressions, which I will do if I must, but I don't like it because it's messy. I'd rather there was one thing I could set to say "send all warnings and errors here".

 

Any advice?

 

Thank you!

 

 

Link to comment
Share on other sites

It's got to be said : don't hide them - FIX them :D never release code to end users untill you have it working bug/error/warning free (believe me, even when you get to this point they will still find problems that you didn't think possible).  It's not going to do you any favours if your users are left looking at a blank page wondering where your site has gone because you've hidden the error message and the script failed.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.