error_reporting(0); question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dnow
Forum Newbie
Posts: 1
Joined: Tue Oct 04, 2011 8:46 am

error_reporting(0); question

Post by dnow »

Hello, This is my first time posting here I'm a new member. I have a question in regards to the error_reporting(0); php function.

I wrote some simple php code for a cs project, Unfortunately when i ran it i received an email from my institution that I have excessive error reports (about 2 million) in a day span.

I was wondering if i add "error_reporting(0);" to my php code will their server still pick up the errors?

Thank you!
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: error_reporting(0); question

Post by twinedev »

it will still log to system error files. When developing code, I usually throw in error_reporting(-1); to display everything to me. IMO, there is never a decent reason for anything to write to an error log (even warnings or notices).

Ask them for a sample of the errors if you do not have access to them so that you can fix them. If not, consider writing your own error handler that will stop execution so at least when you run it, you should only be getting a single error reported.

-Greg
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: error_reporting(0); question

Post by McInfo »

twinedev wrote:it will still log to system error files.
You might be thinking of display_errors, which will hide error messages from the user but still allow them to be recorded in the error log. However, setting error_reporting to a restrictive level will prevent the messages from appearing anywhere, including the error log.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: error_reporting(0); question

Post by pickle »

I'd see about setting the display_errors ini setting so you can seen those errors on the screen & fix 'em.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply