Jump to content

Getting "Notice: Use of undefined constant..." with some scripts on my server.


astounding

Recommended Posts

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.php

OR

http://www.110mb.com/faq2/faq.php

I 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
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.