Jump to content

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


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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.