PHP - How to find current file location
If you are inside php script and you want to find current script location, use this code:
$my_path=$_SERVER['PHP_SELF'];
Note: $my_path will contain full path including filename, e.g.: www.mysite.com/my.php
See details on www.bin-co.com