Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006

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


    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: Notice: Use of undefined constant....



    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?


  2. #2
    Join Date
    Apr 2003
    im no php expert like some of the other guys on this board will be, but the undefined variable error is more likely caused where you're using a variable ($test) that hasnt been set yet. in most languages this is just due to poor coding... in php you dont generally define variables (at least at the levels ive written at!), but before you can do things like comparisons (eg if $test > 10) you need to assign it a value first

  3. #3
    Join Date
    Aug 2006
    I see.

    I was also thinking it may be along the lines of some system php config where it's set to display warning messages to empty variables.

    If anyone know more about this, please kindly share your advice...


  4. #4
    This also happens if you don't quote your associative arrays.
    i.e. you use $_GET[myvariable] instead of $_GET["myvariable"]

    The best solution is to go and fix all these errors. The fast way, if you don't care, is modify the php.ini file and disable all warnings.

  5. #5
    Join Date
    Aug 2006
    all sorted.

    Solution is to put in php.ini:
    error_reporting = E_ALL & ~E_NOTICE

    Error reporting for notices was on, so now I switched it off since notices aren't really errors but only used for debugging purposes.

    Try out Virtual Server Agent free. It could solve all your server downtime worries.

  6. #6
    Join Date
    Apr 2006
    Southern California
    You might want to take out warnings too, those caused troubles for me on a few scripts as well, similar type of things to the notices, not a critical failure, but do show up and stop further execution.
    Sarcasm, the 6th Ponyman of the Apocalypse.
    Please do not inquire about Tim, the 5th Ponyman.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts