Hi guys,
I am trying to locate the location of file being displayed in php.
I have a small file which can be included by any file wither from root or from inside any folder.
i need to print out the location of the.
for long explanation: my config file is config.php located in root location of website i.e localhost/site1/test/. It contains print $_SERVER['SCRIPT_NAME']
. it is being included by index.php in root location and also by database.php inside the includes folder of root.
I get two different result:
localhost/site1/test/, when i include config.php in index.php
localhost/site1/test/includes, when i include config.php in database.php
I would like to get localhost/site1/test in both cases. So what can be the choice instead $_SERVER['SCRIPT_NAME']