Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How to disable error reporting in php?
Old 07-13-2008, 10:32 AM How to disable error reporting in php?
Novice Talker

Posts: 13
Trades: 0
Does anyone know how to disable error reporting in php. I was trying several days but still had not any luck.


Thanks & Rdgs

______________
conservatories Fruit Machines
sujith.it is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-13-2008, 10:38 AM Re: How to disable error reporting in php?
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
you can suppress error reporting by adding @ before the function ie @file_get_contents(url);

you can also set error reporting

You can also set it using the error_reporting() function
http://uk3.php.net/error_reporting

This allows you to set what errors show or not to show at all.

Rep points apprieciated.

Dan
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 07-14-2008, 06:13 AM Re: How to disable error reporting in php?
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
You should not disable and supress error reporting. You should only prevent error messages appearing to your site visitors, but still they should be somehow handled.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 07-14-2008, 08:51 AM Re: How to disable error reporting in php?
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
Quote:
Originally Posted by mtishetsky View Post
You should not disable and supress error reporting. You should only prevent error messages appearing to your site visitors, but still they should be somehow handled.
Care to explain how then?
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 07-14-2008, 09:50 AM Re: How to disable error reporting in php?
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Quote:
Originally Posted by dansgalaxy View Post
Care to explain how then?
Putting:
PHP Code:
error_reporting("E_ALL"
At the top of each page will hide all the errors.

Though, I prefer a nice if(@) as it helps with debugging problems and is a lot faster:
PHP Code:
if(@myfakefunctions()){ // Meaning no problems
// Echo something
} else { // Meaning Epic FAIL!
// Put a debugger here.

I find my second example much better as:
1. You can debug it and see exactly which part is broken (Assuming you debug correctly)
2. It's faster - Lots of errors on the first one will make your page dirt slow.

Though, My best advice is fix the errors instead of hiding them.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 07-14-2008, 10:06 AM Re: How to disable error reporting in php?
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
True.

Exactly what i ment tho lol, on one of my sites i ue the error_reporting() function so when in debug mode (or admin is logged in) it shows all errors but hies for normal users.

works for me..

Dan
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to How to disable error reporting in php?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26051 seconds with 12 queries