getting the "include path" to a file in PHP
<p>I can get the currently executing file with the <code>__FILE__</code> magic PHP constant, but this gives me <code>/var/www/vhosts/.../httpdocs/stacktrace.php</code>. I am trying to get the name of the file so I can pass it into a hidden form field, and then run that script again after the form is submitted.</p>

<p>The script whose file name I am trying to get could be named anything, it's designed to be copied and renamed to any part of a site.</p>

<p>The script will always be included, it'll never be 'the' executed script.</p>

<p>I need to be able to find the path to the file, as it would be used in an include directive (i.e. relative to the include path).</p>

<p>I had hoped using <code>ini_get('include_path')</code> would help me (if it was <code>/var/www/vhosts/.../httpdocs/</code> then I could just cut that part out of the script's file path and it would work), but that just gave me <code>.:.:.:</code>. I don't even know what that means.</p>

<p>Any push in the right direction would help tonnes.</p>
