470,848 Members | 1,220 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

how to suppress error messages without using error_reporting(0) ?

This line:

if (file_exists($fileName)) {
is (on some web servers) giving me this kind of error:
Warning: SAFE MODE Restriction in effect. The script whose uid is 1022
is not allowed to access /home/www owned by uid 0 in
/home/www/krubner/ppKernel/McControllerForAll.php on line 454
This only happens when the software is checking directories that are
above what where PHP is allowed to check.

I want this software to work on all servers and I don't want the end
user to have to know PHP, and so I don't want them to have to set
error_reporting() on their own. I also feel like I shouldn't have to
do this:

error_reporting(0);

because my software should capture all errors on its own and store all
the error messages that I write in the resultsObject that my software
uses. Turning off error reporting is cheating, in my view, the
programmer should capture all errors on their own.

So how do I suppress errors on a line like this?

if (file_exists($fileName)) {
Jul 17 '05 #1
1 6650
lawrence a écrit le 30/04/2004 :
So how do I suppress errors on a line like this?

if (file_exists($fileName)) {


Use the @ operator before the function call :
if(@file_exists($fileName)) {

See manual for more details :
http://www.php.net/manual/en/languag...rorcontrol.php
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Wayno | last post: by
4 posts views Thread by lurisia | last post: by
9 posts views Thread by Jani Jalkala | last post: by
6 posts views Thread by Krishna Srinivasan | last post: by
2 posts views Thread by John Alleyman | last post: by
1 post views Thread by Sheldon Glickler | last post: by
9 posts views Thread by Daniel Smedegaard Buus | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.