|
|
|
|
![]() ![]() |
Apr 21 2008, 07:57 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 387 Joined: 9-February 08 Member No.: 57,615 |
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. QUOTE require_once ("/mulhim.outlaw.trap17.com/library_project/test_dir/test1/config.php");
|
|
|
|
Apr 21 2008, 08:16 AM
Post
#2
|
|
|
Neurotical Squirrel ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 581 Joined: 4-November 04 From: Novi Sad, Vojvodina Member No.: 2,127 |
I suppose your website address here on Trap17 is mulhim.outlaw.trap17.com? If it is, you can change the following line
CODE require_once ("/mulhim.outlaw.trap17.com/library_project/test_dir/test1/config.php"); to CODE require_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... |
|
|
|
Apr 21 2008, 10:01 AM
Post
#3
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 387 Joined: 9-February 08 Member No.: 57,615 |
Ok, that looks understandable. But, I got subdomain which is called: "mulhim". What should I do then?
|
|
|
|
Apr 21 2008, 10:36 AM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 387 Joined: 9-February 08 Member No.: 57,615 |
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. |
|
|
|
Apr 21 2008, 06:31 PM
Post
#5
|
|
|
apt-get moo ![]() Group: [MODERATOR] Posts: 2,052 Joined: 28-May 05 From: Hertfordshire, England Member No.: 7,593 ![]() |
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:
CODE require_once('test_dir/test1/config.php');
|
|
|
|
Apr 21 2008, 07:36 PM
Post
#6
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 387 Joined: 9-February 08 Member No.: 57,615 |
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. |
|
|
|
Apr 22 2008, 03:18 PM
Post
#7
|
|
|
Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 974 Joined: 25-September 05 From: The dungeon deep below the foundation of trap17 Member No.: 12,251 |
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. |
|
|
|
Apr 22 2008, 04:06 PM
Post
#8
|
|
|
apt-get moo ![]() Group: [MODERATOR] Posts: 2,052 Joined: 28-May 05 From: Hertfordshire, England Member No.: 7,593 ![]() |
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:
CODE require_once('../config.php'); The ../ tells PHP to move up to the parent directory, which is where it can find the config.php file. |
|
|
|
Apr 22 2008, 07:37 PM
Post
#9
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 387 Joined: 9-February 08 Member No.: 57,615 |
Ok, thanks. I will try it later on and then, post the answer. Sorry, I got final exams at my UNI to study.
|