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

If a form submits back to same page do you need to use $get
IM trying to pass page number and year that was selected back to the same page.

i have this c

Files in current folder. Should be an easy fix.
Never mind. I've asked about this before and just found my answer. Anyway to delete this?

how to load a Sys file with system load and call images?
normally you need register the module as a service with CreateService, and start the service

Fetching array then reversing it
Hi, I have a simple problem, I'll try to explain it as best I can:
News entries in my database ar

Character increment
Hi,

I am facing a scenario like above,but in my case i want to show up like Col A,Col B etc..

IP Logger for Voting Script
Can anybody help me place an IP logger into my voting script?
I know that maybe it is not as secu

string to currency format
Hi guys...

Actually I chunk out some data from txtfile and one of the data contains amount va

subtract 1 from value entered in text field
Hi

How do I subtract 1 from the vaue entered into a text field?

Thanks

Appending GET data with form submition
Okay, what I'm trying to do is to use a form to append an already existing GET data string.

I

Alternate messaging
I have 4 strings in MySQL db1

$string1 : Hello
$string2 : Hi
$string3 : Great
$strin

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