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

help with this code please?
Hello,

I am trying to build a remote upload script for my image hosting site.

I am usi

Scheduler problems related to execution of a single BLT by many schedules
Hello all,

We are running several MII instances in a distibuted architecture using a sing

Can anyone give me some link on .htaccess tutorial
i wish to have friendly url using .htaccess, but no idea yet about this

Hope that anyone cou

how to transport the Query and insfoset
Hi

I have created the query using SQ01........
How to created T-code for query..

Storing the referrer in session... problems with tabs
Hello All

I am currently working on an ERP project based on the MVC methodology, when a user

PHP time (deadline within one week)
I have a column ['projdue'], which stores the deadline for a project.
I have PHP code and <

j1inmis Ouput layout changes
Hi,

Can anybody tell how can j1inmis output layout can be changed so that vendor names ge

$action = "insert"; //$action = $_GET['action'];
$action = "insert";
//$action = $_GET['action'];

why is this invalid type? I am

Php navigation
I have four buttons on a php page.
If i click a button it will redirect to different php pages.

CODE NOT WORKING
Code: [Select]<?php
//include shared codes

include '../lib/common.php';
include

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