Page 1 of 1

error level

Posted: Fri Apr 25, 2003 9:40 am
by wallabee
I just recently found that most of the errors I've been getting have to do with the fact that after PHP was installed on my host's server, no one changed it from the default development error levels. I asked my host to change it, and I think he may have set it too low- what does everyone have for their error level? What's the best recommendation for someone who is just getting beyond the beginnings of PHP?

-ben

Posted: Fri Apr 25, 2003 10:17 am
by d1223m
you can always set this at the top of every page.
or failing that, most sites tend to have one file that is included at the top of every page.

you generally want all error reporting on except notices.
warnings should really be fixed not just ignored by lowering the error reporting

Posted: Fri Apr 25, 2003 11:53 am
by twigletmac
In development you want error reporting as high as possible so you can fix anything that comes up.

On a live server you really don't want to be displaying errors to your users so choose whichever level you feel is appropriate and log it to a file.

Mac

Posted: Fri Apr 25, 2003 12:08 pm
by wallabee
thanks for the help. i actually just discovered error logging to a txt file, as well as setting the error level, while reading my PHP book on the way back from class today.

my main concern is that the book i've been learning from (peachpit press, i've always had good luck with them. probably won't buy a coding book from them again, though) uses a method of "testing" to see if a variable is live by merely going:

Code: Select all

if ($variable){
    do this;
    and this;
}
obviously this kept popping up warnings. isset() is probably the best for this, but is there any actual downside to using the above method besides the obvious warnings showing up?

-ben

Posted: Sat Apr 26, 2003 5:12 am
by twigletmac
wallabee wrote:isset() is probably the best for this
Definitely, the other method shouldn't be used unless you are testing to see if a variable has a value of true or false.
wallabee wrote:but is there any actual downside to using the above method besides the obvious warnings showing up?
The warnings are the downside, isset() or empty() won't give you errors.

<moan>It's unfortunate that the authors of a number of books never set their error reporting higher than the old defaults otherwise they might have done the coding properly.</moan>

Mac

Posted: Sat Apr 26, 2003 11:19 am
by wallabee
you toss this idea that they didn't take into consideration E_ALL, in with the fact that they advertise PHP4, though don't use $_GET['var'], and instead just assume $var, and you've got a very confused novice at PHP trying to learn a book that's going to give him errors anyway.

i came out somewhat fine.

Posted: Sat Apr 26, 2003 2:30 pm
by []InTeR[]
twigletmac wrote:<moan>It's unfortunate that the authors of a number of books never set their error reporting higher than the old defaults otherwise they might have done the coding properly.</moan>
That's a point.

Errorhandle'ing is a great part of a good source.

I have a script before my all php (du to a config), and all error's are mailed to me. If whe devolep a program, whe have a var $DEBUG set to TRUE, and then all error's are reported to the screen instead of mail.

A client 'never' gets to see a error. And if one happens to sneak by, whe solved it before the client call's us. :)