mickstevens Posted March 1, 2011 Share Posted March 1, 2011 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! Quote Link to comment https://forums.phpfreaks.com/topic/229214-hide-error-messages-from-browser/ Share on other sites More sharing options...
litebearer Posted March 1, 2011 Share Posted March 1, 2011 No offense but if it is user caused errors, you should show them. If the errors are internal/script errors you should resolve them Quote Link to comment https://forums.phpfreaks.com/topic/229214-hide-error-messages-from-browser/#findComment-1181086 Share on other sites More sharing options...
PFMaBiSmAd Posted March 1, 2011 Share Posted March 1, 2011 Well written and tested code doesn't produce php errors when it runs and you shouldn't put code onto a live server until it has been completely tested. Quote Link to comment https://forums.phpfreaks.com/topic/229214-hide-error-messages-from-browser/#findComment-1181087 Share on other sites More sharing options...
Muddy_Funster Posted March 1, 2011 Share Posted March 1, 2011 It's got to be said : don't hide them - FIX them 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. Quote Link to comment https://forums.phpfreaks.com/topic/229214-hide-error-messages-from-browser/#findComment-1181169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.