Best Practices for Hiding Errors
| From: | George Langley | Date: | Mon, 06 Apr 2009 22:41:39 +0000 |
| Subject: | Best Practices for Hiding Errors | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-291144@lists.php.net to get a copy of this message | ||
Hi all! Have a question about hiding PHP errors from the end user.
I have the following lines:
$fp = fsockopen ($host, 80, $errno, $errstr, $timeout);
if (!$fp) {
// problem, put error handing code here
} else {
// success, do whatever here
}
but if fsockopen is unsuccessful, PHP will display an error warning on the page before it even gets
to my error handling code.
I found the display_errors command at:
< http://ie.php.net/manual/en/errorfunc.configuration.php#ini.display-errors>
but they give the following warning:
"This is a feature to support your development and should never be used on production systems
(e.g. systems connected to the internet)."
Am unclear what that means - is it okay to add:
ini_set('display_errors','Off');
to my page, so that an end user won't ever get the warning displayed and I can deal with the
error behind the scenes? Or is there a better way to keep PHP from writing error codes to the
screen?
Thanks!
George Langley Multimedia Developer Audio/Video Editor Musician, Arranger, Composer
www.georgelangley.ca