I can get the currently executing file with the __FILE__ magic PHP constant, but this gives me /var/www/vhosts/.../httpdocs/stacktrace.php. 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.
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.
The script will always be included, it'll never be 'the' executed script.
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).
I had hoped using ini_get('include_path') would help me (if it was /var/www/vhosts/.../httpdocs/ then I could just cut that part out of the script's file path and it would work), but that just gave me .:.:.:. I don't even know what that means.
Any push in the right direction would help tonnes.