May 16, 2008

Located Url? - PHP?

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Located Url? - PHP?

alex1985
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");

Reply

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

Reply

alex1985
Ok, that looks understandable. But, I got subdomain which is called: "mulhim". What should I do then?

Reply

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

Reply

rvalkass
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');

Reply

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

Reply

galexcd
QUOTE(alex1985 @ Apr 21 2008, 03:36 AM) *
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.

Reply

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

Reply

alex1985
Ok, thanks. I will try it later on and then, post the answer. Sorry, I got final exams at my UNI to study.

Reply

alex1985
QUOTE(rvalkass @ Apr 22 2008, 08:06 PM) *
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.


Thanks. This reply helped me. It does work now.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:


Searching Video's for located, url, php,
advertisement



Located Url? - PHP?



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE