TomTees Posted November 25, 2010 Share Posted November 25, 2010 I am following a book and need help setting up Path Constants. Here is the script I need to adjust... // Constants define('BASE_URI', '/path/to/Web/parent/folder/'); define('BASE_URL', 'www.example.com'); define('MYSQL', '/path/to/mysql.inc.php'); Since I am working in NetBeans, I do not have access above my Project Folder which serves as my "Web Root". So if my Project Folder is called "MyProjectFolder", and I want both BASE_URI and BASE_URL to point to that directory on my laptop, what should I put? I'm thinking something like this... // Constants define('BASE_URI', '/'); define('BASE_URL', '/'); define('MYSQL', '/includes/mysql.inc.php'); TomTees Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/ Share on other sites More sharing options...
btherl Posted November 25, 2010 Share Posted November 25, 2010 BASE_URL should probably look like the original one, ie a host name. Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139672 Share on other sites More sharing options...
TomTees Posted November 25, 2010 Author Share Posted November 25, 2010 BASE_URL should probably look like the original one, ie a host name. Again, I am developing locally on my laptop. There is no web URL... That is why I am asking how to set it up locally and point it to my Web Root. TomTees Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139678 Share on other sites More sharing options...
btherl Posted November 25, 2010 Share Posted November 25, 2010 What do you type into the browser when you want to see the website? Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139679 Share on other sites More sharing options...
TomTees Posted November 25, 2010 Author Share Posted November 25, 2010 What do you type into the browser when you want to see the website? I don't type anything. I hit Shift+F6 in NetBeans. TomTees Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139686 Share on other sites More sharing options...
trq Posted November 25, 2010 Share Posted November 25, 2010 Which opens a browser. What base url do you see in the browsers address? Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139691 Share on other sites More sharing options...
TomTees Posted November 25, 2010 Author Share Posted November 25, 2010 Which opens a browser. What base url do you see in the browsers address? http://localhost/01_KnowledgeIsPower/index.php where "01_KnowledgeIsPower" is the name of my "project" in NetBeans. TomTees Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139696 Share on other sites More sharing options...
btherl Posted November 25, 2010 Share Posted November 25, 2010 Try these settings: // Constants define('BASE_URI', '/01_KnowledgeIsPower/'); define('BASE_URL', 'localhost'); define('MYSQL', '/includes/mysql.inc.php'); It's a bit tricky to know what they're expecting there, as those are not what I would normally consider a URI or URL. So instead I'm trying to go based on the example values. Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139703 Share on other sites More sharing options...
TomTees Posted November 26, 2010 Author Share Posted November 26, 2010 Try these settings: // Constants define('BASE_URI', '/01_KnowledgeIsPower/'); define('BASE_URL', 'localhost'); define('MYSQL', '/includes/mysql.inc.php'); It's a bit tricky to know what they're expecting there, as those are not what I would normally consider a URI or URL. So instead I'm trying to go based on the example values. What they are expecting was documented in my original post. I tried your idea above but it doesn't seem to work. config.inc.php define('BASE_URL', 'localhost'); index.php <?php include (BASE_URL . '/includes/footer.html'); ?> Yields this error... Warning: include(localhost/includes/footer.html) [function.include]: failed to open stream: No such file or directory in /Users/user1/Documents/DEV/++htdocs/01_KnowledgeIsPower/index.php on line 23 Call Stack # Time Memory Function Location 1 0.0012 56064 {main}( ) ../index.php:0 TomTees Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139712 Share on other sites More sharing options...
trq Posted November 26, 2010 Share Posted November 26, 2010 You shouldn't be including files via urls, you include files via the file system path to that file. Your going to need to provide more information about what the settings should be, the examples are not helping because obviously they aren't correct and the names of the constants aren't exactly meaningful. Quote Link to comment https://forums.phpfreaks.com/topic/219831-help-setting-up-path-constants/#findComment-1139740 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.