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
https://forums.phpfreaks.com/topic/229214-hide-error-messages-from-browser/
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.

Archived

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

×
×
  • 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.