finding the physical path of an include file when parsing

This is a discussion on finding the physical path of an include file when parsing within the alt.comp.lang.php forums, part of the PHP Programming Forums category; How do I find the path to an include file from inside the file when loaded? The file is located ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-22-2004
advertis
 
Posts: n/a
Default finding the physical path of an include file when parsing

How do I find the path to an include file from inside the file when loaded?
The file is located above the doc root. The script which includes the file
is located in the doc root. The included file needs to include additional
files located in the same directory as itself. I am trying not to have to
edit the php.ini include_path or to set it at run-time using set_ini().

Any help would be appreciated. thanks

Patrick


Reply With Quote
  #2 (permalink)  
Old 10-22-2004
Chris Hope
 
Posts: n/a
Default Re: finding the physical path of an include file when parsing

advertis wrote:

> How do I find the path to an include file from inside the file when
> loaded? The file is located above the doc root. The script which includes
> the file is located in the doc root. The included file needs to include
> additional files located in the same directory as itself. I am trying not
> to have to edit the php.ini include_path or to set it at run-time using
> set_ini().
>
> Any help would be appreciated. thanks


realpath(__FILE__) will give you the full real path name to the current
file.

http://www.php.net/realpath

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Reply With Quote
  #3 (permalink)  
Old 10-23-2004
advertis
 
Posts: n/a
Default Re: finding the physical path of an include file when parsing

Works Great! thanks

"Chris Hope" <blackhole@electrictoolbox.com> wrote in message
news:1098485052_35193@216.128.74.129...
> advertis wrote:
>
> > How do I find the path to an include file from inside the file when
> > loaded? The file is located above the doc root. The script which

includes
> > the file is located in the doc root. The included file needs to include
> > additional files located in the same directory as itself. I am trying

not
> > to have to edit the php.ini include_path or to set it at run-time using
> > set_ini().
> >
> > Any help would be appreciated. thanks

>
> realpath(__FILE__) will give you the full real path name to the current
> file.
>
> http://www.php.net/realpath
>
> --
> Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/



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 12:35 AM.


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