steveangelis Posted December 14, 2008 Share Posted December 14, 2008 I know this is something stupid but I cannot see what is wrong. I am trying a simple require for a config file and it cannot find the file even though I KNOW it is there. The file is located here: root/forums/config.php The file calling it up is here: root/home/index.php?p=members I should note I am doing a template based website and the members file is located at this but it should not affect it at all: root/home/modules/members.php Here is my code: require('../forums/config.php'); This should work but no matter what I do it does not and I know the path is correct. Ideas? Quote Link to comment https://forums.phpfreaks.com/topic/136955-simple-and-stupid/ Share on other sites More sharing options...
kpetsche20 Posted December 14, 2008 Share Posted December 14, 2008 forums/ is not a folder change the code to this require('../config.php'); Quote Link to comment https://forums.phpfreaks.com/topic/136955-simple-and-stupid/#findComment-715271 Share on other sites More sharing options...
steveangelis Posted December 14, 2008 Author Share Posted December 14, 2008 The config file is in the folder called forums as is the site in a folder called home. In any case that does not work either. I even tried putting the config file into the same folder as the rest of the site and it had no affect. Quote Link to comment https://forums.phpfreaks.com/topic/136955-simple-and-stupid/#findComment-715272 Share on other sites More sharing options...
wildteen88 Posted December 14, 2008 Share Posted December 14, 2008 use require($_SERVER['DOCUMENT_ROOT'].'/forums/config.php'); Quote Link to comment https://forums.phpfreaks.com/topic/136955-simple-and-stupid/#findComment-715276 Share on other sites More sharing options...
steveangelis Posted December 14, 2008 Author Share Posted December 14, 2008 Same thing. It does not work even though I know that the path is correct. Quote Link to comment https://forums.phpfreaks.com/topic/136955-simple-and-stupid/#findComment-715281 Share on other sites More sharing options...
wildteen88 Posted December 14, 2008 Share Posted December 14, 2008 So you have: require('../forums/config.php'); In members.php which is located in root/home/modules in that case you're path should be ../../forums/config.php ../ goes one level higher up the directory tree. The first ../ goes out of the modules/ folder, the second ../ goes out of the home/ folder. However my suggestion should work though. Quote Link to comment https://forums.phpfreaks.com/topic/136955-simple-and-stupid/#findComment-715286 Share on other sites More sharing options...
steveangelis Posted December 14, 2008 Author Share Posted December 14, 2008 Yes but I am templating it all. I semi figured it out. I changed the directory name forums to something else and it works now... Quote Link to comment https://forums.phpfreaks.com/topic/136955-simple-and-stupid/#findComment-715288 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.