mikeskinner Posted February 25, 2010 Share Posted February 25, 2010 Just took over this site for a client. I did not build it nor do i know much about PHP. I am currently running WAMP for testing purposes on my local machine. Problem: The site tests fine and displays fine on my local machine as long as there is an internet connection. So the testing site is pulling something from the live site and I am not sure what it is. Seems related to styles, as the content displays without formatting and I get the error below. Here is the error: Notice: Use of undefined constant USE_BASE_ROOT - assumed 'USE_BASE_ROOT' in C:\Documents and Settings\username\My Documents\wamp\www\MySite\local\local.php on line 17 Here is the code for local.php: <?php // ------------------------------------------------------------ // ROOT // // Defines a relative path, if needed // ------------------------------------------------------------ if (USE_BASE_ROOT === false) { DEFINE("ROOT", "../"); } DEFINE("ROOT", ""); DEFINE("BASE_HREF", "http://www.mysite.com/"); // ------------------------------------------------------------ // DATABASE // // Database connection URL: // mysql://[user]:[password]@[hostname]/[tablename] // ------------------------------------------------------------ $MYSQL_URL = "mysql://mysite@localhost/mysite"; ?> This last question might be related. When testing on my local machine, when I test one page and try to navigate to another page, the nav link brings me to the live site on the internet. This is due to the use of absolute urls on the site. Is there a reason it was set up that way? Why not use relative urls? The way it is currently set up i have to navigate to each page by manually typing in the url or else I am brought to the live site. Any thoughts on this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/193384-undefined-constant-error-on-local-testing-server/ Share on other sites More sharing options...
schilly Posted February 25, 2010 Share Posted February 25, 2010 USE_BASE_ROOT looks like some kind of flag. The code provided doesn't determine where it is defined though. Is there an include file that gets included above local.php? do the links use BASE_HREF? If they do you could just change this to have the links work locally. Quote Link to comment https://forums.phpfreaks.com/topic/193384-undefined-constant-error-on-local-testing-server/#findComment-1018157 Share on other sites More sharing options...
mikeskinner Posted February 25, 2010 Author Share Posted February 25, 2010 Thanks for responding. here is the other include file: dochead.php: <!-- dochead start --> <base href="<?= BASE_HREF ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="common/frame.css" rel="stylesheet" type="text/css" /> <link href="common/style.css" rel="stylesheet" type="text/css" /> <script language="JavaScript" src="common/functions.js"></script> <!-- dochead end --> Quote Link to comment https://forums.phpfreaks.com/topic/193384-undefined-constant-error-on-local-testing-server/#findComment-1018167 Share on other sites More sharing options...
wildteen88 Posted February 25, 2010 Share Posted February 25, 2010 Seems you're dealing with a poorly designed PHP application. To stop the notice message (not an error) from appearing you can change this line if (USE_BASE_ROOT === false) { to if (defined('USE_BASE_ROOT') && USE_BASE_ROOT === false) { Quote Link to comment https://forums.phpfreaks.com/topic/193384-undefined-constant-error-on-local-testing-server/#findComment-1018168 Share on other sites More sharing options...
schilly Posted February 25, 2010 Share Posted February 25, 2010 hmmmm USE_BASE_ROOT not defined there either. Quote Link to comment https://forums.phpfreaks.com/topic/193384-undefined-constant-error-on-local-testing-server/#findComment-1018169 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.