how to include a file from another dir

This is a discussion on how to include a file from another dir within the PHP Language forums, part of the PHP Programming Forums category; Hey I wonder how i can include a file from another directory.... is this possible ? include('/directory/file.php'); Dennis ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-03-2004
Dennis T. Holm
 
Posts: n/a
Default 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


Reply With Quote
  #2 (permalink)  
Old 11-03-2004
Michael Fesser
 
Posts: n/a
Default Re: how to include a file from another dir

.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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:01 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0