George Langley wrote:
>       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
> 

You can probably do:

$fp = @fsockopen ($host, 80, $errno, $errstr, $timeout);
// the @ suppresses the error

However, what they mean by the "never be used on production systems" is
that display errors should not be "On" on a production system.  You
should change it to "Off" in your php.ini, or if you can't use the
ini_set() in your script.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to