FILE is the location of the current file in the server's file structure. It has nothing to do with the requested page.
$SERVER['PHPSELF'] will be the file that kicked off the process - index.php for Joomla or Drupal.
$SERVER['REQUESTURI'] is the path the browser is looking for, regardless of what file actually was started by Apache due to the rewrite rules.
From the sound of your request you are looking for FILE which will give you the file path to your script from your script. Just keep in mind that is not the URI the world sees for your script, that's contained in $SERVER['REQUESTURI']. However, the latter is of little use when loading files on the file system.