Include ("Absolute Path") of a file?


Posted on 16th Feb 2014 07:03 pm by admin

I'm not sure what I'm doing wrong. I am writing my php code in the same directory of the file that I wish to include is in. So, here's what I have written:

Code: include ('file.php');
This works without any problems. However, I wish to link to this file using an absolute path, rather than a relative one. According to most online tutorials, I would use the following code:

Code: include ($_SERVER['DOCUMENT_ROOT'] . '/directory/file.php');
However, this does not work. Does anyone know what the problem might be?

No comments posted yet

Your Answer:

Login to answer
349 Like 49 Dislike
Previous forums Next forums
Other forums

ob_ dynamic content
i was wondering about the potential to use ob to create a <div then remove it when the page

Printer configuration
Hi All,
Suppose one of the user deleted the printer settings unfortunatly ,then what is the pro

Sequencing or queuing parallel process
Scenario is as follows
There is one parent process say P1 and 4 child processes say A B C D

Upload Code Help
Hi everyone I need some help with a bit of code ive been working with for a while. I am completely s

Email/MMS to Site
Hey guys. I'm looking for a way for a user to upload images and/or text via their cell phones. It

php + mysql count consecutive data
I have a database of values and I want to work out how to display them if the values match a consecu

Displaying a clickable playername
I am going wrong somewhere with the mysql_query, can someone please put me straight?

$playern

Wierd if else problem
Hi guys,

this probably aint wierd for you, but it seems like php is playin up to me. may b i

Secure pages Sessions vs. Cookies & session_destroy() help
Im new here and new to PHP, I hope you can help me with some questions.

Im writing my web ap

SQL Injection
In my attempts to protect my database from mySQL injection I have created another problem for myself

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash