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!
Welcome to the forum! It looks to me that your warning level is set a little higher than you would like. In your PHP configuration file there is an error_reporting directive. I believe you probably want E_ALL & ~E_NOTICE. Right now I would guess you're probably running with just E_ALL.
nowaydown1 wrote:It looks to me that your warning level is set a little higher than you would like. In your PHP configuration file there is an error_reporting directive. I believe you probably want E_ALL & ~E_NOTICE. Right now I would guess you're probably running with just E_ALL.
Many thanks, you were absolutely right and the pesky notices are no longer an issue.
Not that I want to be picky or something but I strongly suggest you don't remove those noticy by supressing error_reporting. Your best bet is to fix thouse. Other than that you should just have display_errors no on production environment... this will allow for errors/notices or whatever not to be seen but still be logged (if logging enabled of course). By hiding this problem now, you might totally misunderstand a problem in the future that might be related.
jmut wrote:I strongly suggest you don't remove those noticy by supressing error_reporting. Your best bet is to fix thouse.
It certainly occurred to me that hiding the issue was second-best to fixing it, but as a site manager with a boss demanding that the notices be removed because it affected the user experience, it was a useful first step.
As a postscript, it emerged that the notices - and several othe problems - were all related to a PHP4 to PHP5 upgrade by our webhosts late last week. The original site developer was persuaded to fix all the issue and as of this morning everything is working properly again.
farmersguide wrote:As a postscript, it emerged that the notices - and several othe problems - were all related to a PHP4 to PHP5 upgrade by our webhosts late last week.
The notice appeared because your PHP4 installation was configured to surpress notices, but not your PHP5 installation. The notice appears when you do this for example:
Just configure display_errors directive to be off in live environment. thats all. Users will never see problems. At very worst (fatal error) they will see blank screen. But you examining the logs will see it all (including notices etc). So bottom line:
1. Always have error_reporting (E_ALL) unless using some weird 3rd party lib that is <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> and you can't fix and don't want log cludge. For those I usually make wrapper that I can easily lower error_reporting only when calling specific method from 3rd party lib..and back to E_ALL then.
2. Have display errors off in production and enabled logging. Better in project dir than in server /tmp folder...those might get lost
Glad you solved issue.