473,320 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to include a file from another dir

Hey

I wonder how i can include a file from another directory....

is this possible ?

include('/directory/file.php');

Dennis T. Holm
Jul 17 '05 #1
1 1806
.oO(Dennis T. Holm)
I wonder how i can include a file from another directory....

is this possible ?

include('/directory/file.php');


If the directory exists, sure. But be aware that PHP accesses the files
directly through the filesystem. The above would start from the root
directory of the filesystem, not the document root of the webserver. If
you want to start from the document root you can use something like
this:

include $_SERVER['DOCUMENT_ROOT'].'/file.php';

It's also possible to access files outside the document root:

include $_SERVER['DOCUMENT_ROOT'].'/../include/file.php';

Micha
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Vojma | last post by:
I have a problem At my site I have designed a framework with tabs as below (tabs_1.asp) +----+ +------+ +-------+ | MC | | Cars | | Boats | + +------------------------- then, into...
10
by: Toke H?iland-J?rgensen | last post by:
Hello. I am quite new to the c++ language, and am still trying to learn it. I recently discovered how using include files would allow me to split up my code into smaller segments, instead of having...
6
by: Puzzled | last post by:
This is a weird problem, but perhaps someone else has seen it before (I hope!) If I use a fully qualified include call include ( 'http://localhost/subtree/filename.php') I get an 'undefined...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
9
by: bill | last post by:
Forget the exact definition of difference between, #include <foo.h> and #include "bar.h" Normally foo.h is a standard header file, so it's path is not defined in compiler option, but I...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
11
by: MBS | last post by:
I am playing around with some PHP code. I want to put in an include() function so I can include existing HTML code and output it to the browser. Lo and behold PHP does not support relative paths...
14
by: @sh | last post by:
Guys, We're in the midst of building a new site and have some decisions to make RE the meta data, i.e. Title, Keywords and Description. We need to allow other non development staff to update...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
19
by: Earl Partridge | last post by:
FP 2000 I have a single Include file that I want to use on multiple sites. I'm trying to use the following (or some variation) but can't make it work. <!--#INCLUDE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.