finding the physical path of an include file when parsing

Ask a Question related to PHP Development, Design and Development.

  1. #1

    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


    advertis Guest

  2. Similar Questions and Discussions

    1. Retrieving physical path on the server
      Hi everyone, this is my first message on a macromedia forum, so I hope I've choosen the right forum... if not, please tell me :) My problem is...
    2. ASP File Include Path
      Hi I have a #Include statement in an Asp page. I want to find the path of the included file at runtime. How can I do that? Please Help! -...
    3. finding subdirectories without parsing every file
      Hi Is there any way to get the subdirectories of a directory without having to sort through all the files in a directory? I'm actually...
    4. parsing verilog files to finding the various module definations in the file
      I need to parse a large verilog file and get the various modules in the file. A simple example of the module is as shown below. I need help to...
    5. Convert Physical path to Virtual path?
      We have a field that gets filled into a database that our ASP website pulls from. What we would like to be able to do is to take that path and...
  3. #2

    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.

    [url]http://www.php.net/realpath[/url]

    --
    Chris Hope - The Electric Toolbox - [url]http://www.electrictoolbox.com/[/url]
    Chris Hope Guest

  4. #3

    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.
    >
    > [url]http://www.php.net/realpath[/url]
    >
    > --
    > Chris Hope - The Electric Toolbox - [url]http://www.electrictoolbox.com/[/url]

    advertis Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139