For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2004 > finding the physical path of an include file when parsing









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author finding the physical path of an include file when parsing
advertis

2004-10-22, 8:55 pm

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


Chris Hope

2004-10-22, 8:55 pm

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/
advertis

2004-10-22, 8:55 pm

Works Great! thanks

"Chris Hope" <blackhole@electrictoolbox.com> wrote in message
news:1098485052_35193@216.128.74.129...
> advertis wrote:
>
includes[color=darkred]
not[color=darkred]
>
> 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/



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com