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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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/ |
|
|||
|
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/ |