Display Errors Off -> set_error_handler()

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
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Display Errors Off -> set_error_handler()

Post by seodevhead »

If in php.ini, Display_Errors is set to 'OFF' and you use the set_error_handler() function in your script and supply a error handling function... do the errors display? Ideally I would like to have display_errors turned off always and override it with a switch using set_error_handler('myerrorfunction');. Thanks for your help.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

heres the order you should try things

1) Try it yourself
2) Google
3) Post here

Have you tried #1?
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Post by seodevhead »

1) I have the error handling function with set_error_handler() implemented, but I do not have display_errors set to OFF yet. Because I do not know how to access php.ini, I thought I would find out if I even can do this at all before opening up another can of worms.

2) I did a couple searches and did not find an answer.

3) I can't believe you want to "filter" questions -- like this one, which is most obviously valid and on-topic. Hopefully someone can lend me a helping hand on this legitimate question as a fellow developer. :)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

We filter out questions the questions that should have be atleast attempted in the first place. Not to sound unhelpful, but it is not our place here to promote users to ask first then try it for themselves later.. that simply isn't fair to us who donate our time when the user could have tried it himself.

To answer your question -- your custom error handler will still be executed.
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Post by seodevhead »

Hey Jcart... no problem at all.. I completely understand. I would hope that all posters take it upon themselves to put forth an attempt to solve their problems before handing them off to more experienced developers. But I would also hope that all posters, whether in the asking or answering categories, feel welcome to post as such. Thanks for the answer on the question. Looks like it will be best for me to just turn display_errors to OFF in the php.ini and use my error_handler() function for my scripts. Thanks again.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

You should learn about php.ini. Configuration issues are nasty bugs that are hard to track down.
Post Reply