Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 04-10-2015, 03:24 PM
basketmen basketmen is offline
Contributing Member
 
Join Date: 03-21-07
Posts: 97
iTrader: 0 / 0%
[Whats make this error] PHP Notice: Use of undefined constant

I just moved to new host
In this new host i always got error_log, even with this simple php file :
PHP Code:
<?php define(Y,120); ?>
this is the error_log content:
Quote:
[09-Apr-2015 18:42:09 UTC] PHP Notice: Use of undefined constant Y - assumed 'Y' in /home/username/public_html/test.php on line 1

i can add single quote wrapping the Y like this to fix it
PHP Code:
<?php define('Y',120); ?>
but there are a lot of code like that, it is better if i dont need to change the files,
but just change the hosting required, what is it actually? is it because using litespeed?

in old hosting there is cgi-fcgi information


in new hosting is using litespeed
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 04-10-2015, 03:46 PM
ScriptMan's Avatar
ScriptMan ScriptMan is online now
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,018
iTrader: 4 / 100%
I seem to recall something about a PHP version difference.

At any rate this link should help you.

http://stackoverflow.com/questions/9...fined-constant
 
Reply With Quote
  #3  
Old 04-10-2015, 04:17 PM
basketmen basketmen is offline
Contributing Member
 
Join Date: 03-21-07
Posts: 97
iTrader: 0 / 0%
but this php file & other scripts are working in my previous hosting, is it because litespeed in new hosting?

already tried change php version 5.1-5.6 using cloudlinux php selector, all results still same, so the php version looks like not the culprit
 
Reply With Quote
  #4  
Old 04-11-2015, 04:34 AM
J. H. Rasmussen J. H. Rasmussen is online now
Super Moderator
 
Join Date: 11-11-11
Location: Copenhagen, Denmark
Posts: 5,997
iTrader: 1 / 100%
While i would recommend that you program php-scripts the right way e.g. use define('Y',120) instead fo define(Y,120), here is some information that may be helpful.

You could probably add this code in the beginning of the php-files, to prevent php from throwing E_NOTICE-errors:
PHP Code:
// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE); 
Source: http://php.net/manual/en/function.error-reporting.php
Since php is assuming that Y is 'Y' it would still work if you just make sure that php isn't throwing E_NOTICE-errors.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Whats the best way to make money from my site? MadKad Webmaster Revenue 15 10-09-2011 10:07 AM
I'm getting error notice "Notice: Undefined index:" ameerulislam Coding Forum 8 05-27-2011 03:28 PM
Error "Undefined index" anyname4u1 Coding Forum 1 10-04-2010 02:52 PM
Whats Required To Make $ From Websites? visionedger Webmaster Revenue 15 08-28-2006 03:07 PM
Whats the best way to make a site map?? Canz SEO Forum 18 01-08-2004 05:00 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 06:05 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC