astounding Posted November 5, 2006 Share Posted November 5, 2006 Hey,While I had cPanel installed on my server all was fine. I then did a format and installed CentOS.Forums and CMS scripts install without a problem.But I noticed that with some scripts I'm getting these messages all over the place: [b]Notice: Use of undefined constant....[/b]Eg:http://andre.110mb.com/phpbuild.phpORhttp://www.110mb.com/faq2/faq.phpI figured that this always happens whenever a script has an empty variable in it like: variable=" ";It can't be the scripts as they all work fine on other servers. So I'm assuming this is something gotta do with my php config.Any tips on how to fix this server wide?Thanks.-A Quote Link to comment https://forums.phpfreaks.com/topic/26234-getting-notice-use-of-undefined-constant-with-some-scripts-on-my-server/ Share on other sites More sharing options...
Stooney Posted November 5, 2006 Share Posted November 5, 2006 you could always just set error_reporting() differently. http://us3.php.net/manual/en/function.error-reporting.php Quote Link to comment https://forums.phpfreaks.com/topic/26234-getting-notice-use-of-undefined-constant-with-some-scripts-on-my-server/#findComment-120011 Share on other sites More sharing options...
wildteen88 Posted November 5, 2006 Share Posted November 5, 2006 Its actually to do with how the PHP app was coded. Looks like the developer(s) where being lazy and not putting quotes around the keys when calling an item from an array.For example in your script there most probably variables like this:$some_var[some_key] if you do that then PHP thinks you're wanting to use a constant called some_key. However PHP is smart enough to figure out you mean 'some_key' and thus PHP brings up a Notice error. Quotes should be wrapped around keys. However not many developers do!Unless you know how to code in PHP then there is not much you can do but turn off the display_errors directive. That way no errors/notices will be shown. Ideally you shouldn't have errors shown on a live box. Quote Link to comment https://forums.phpfreaks.com/topic/26234-getting-notice-use-of-undefined-constant-with-some-scripts-on-my-server/#findComment-120020 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.