alex1985 0 Report post Posted April 21, 2008 I did the configuration file for my web-site but there is a mistake, it can find the path to that configuration file.Could you give me the proper way to set a correct path to the configuration file.This is what I did actually based on the used tutorial. require_once ("/mulhim.outlaw.trap17.com/library_project/test_dir/test1/config.php"); Share this post Link to post Share on other sites
Galahad 0 Report post Posted April 21, 2008 I suppose your website address here on Xisto is mulhim.outlaw.trap17.com? If it is, you can change the following line require_once ("/mulhim.outlaw.trap17.com/library_project/test_dir/test1/config.php");torequire_once ("library_project/test_dir/test1/config.php"); And that should fix your problem... What you tried earlier, is to tll PHP to look for a configuration file in directory mulhim.outlaw.trap17.com then library_project subdirectory, etc... You don't have to specify your own domain in require... Hope this solves your problem... Share this post Link to post Share on other sites
alex1985 0 Report post Posted April 21, 2008 Ok, that looks understandable. But, I got subdomain which is called: "mulhim". What should I do then? Share this post Link to post Share on other sites
alex1985 0 Report post Posted April 21, 2008 I did it just now, and it does not work. I tried: "mulhim/library_project/test_dir/test1/config.php" and "mulhim.library_project/test_dir/test1/config.php"Any more suggestions. Share this post Link to post Share on other sites
rvalkass 5 Report post Posted April 21, 2008 Which directory is the script being run from, as the path needs to be relative to that location. For example, if the script is in /public_html/mulhim/library_project/ then you would just need this as your code: require_once('test_dir/test1/config.php'); Share this post Link to post Share on other sites
alex1985 0 Report post Posted April 21, 2008 I will try it tomorrows, and then post the answer if it's working or not, it's too late now. I hope it will.You are definitely right, the script which I want to initiate is located in test1 folder, but there is admin folder inside the test1 folder and the page that adds entries to database like add.php is located inside the admin folder.So, add.php has that function (require_once) in ...test1/admin/add.php location that has to find the config.php in ...test1/config.php. That's why I need the proper code or location for the url.I did not tried the previous post, as I said I will do it tomorrow. So, I did explain in detail.Thanks. Share this post Link to post Share on other sites
galexcd 0 Report post Posted April 22, 2008 I did it just now, and it does not work. I tried: "mulhim/library_project/test_dir/test1/config.php" and "mulhim.library_project/test_dir/test1/config.php"Any more suggestions. Like true-fusion said, you are not in the web-root directory like your mulhim folder is, and when you type a forward slash at the beginning, php automatically goes to the first root, not the web root. You could try either "/www/mulhim/library_project/test_dir/test1/config.php" or something like "/home/outlaw/www/mulhim/library_project/test_dir/test1/config.php". you need to figure out the path to your web root, and then stick "mulhim/library_project/test_dir/test1/config.php" behind it. Share this post Link to post Share on other sites
rvalkass 5 Report post Posted April 22, 2008 As alex7h3pr0gr4m3r has said, starting the path with a / makes PHP start from the root directory rather than your current location. The easiest way to do it will be the following: require_once('../config.php'); The ../ tells PHP to move up to the parent directory, which is where it can find the config.php file. Share this post Link to post Share on other sites
alex1985 0 Report post Posted April 22, 2008 Ok, thanks. I will try it later on and then, post the answer. Sorry, I got final exams at my UNI to study. Share this post Link to post Share on other sites
alex1985 0 Report post Posted April 23, 2008 As alex7h3pr0gr4m3r has said, starting the path with a / makes PHP start from the root directory rather than your current location. The easiest way to do it will be the following: require_once('../config.php'); The ../ tells PHP to move up to the parent directory, which is where it can find the config.php file. Thanks. This reply helped me. It does work now. Share this post Link to post Share on other sites