Jump to content

Undefined Constant Error on local testing server


mikeskinner

Recommended Posts

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

 

Link to comment
Share on other sites

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.