if you txt file is in the same directory as your script use something like this
$thisDir = dirname($_SERVER['SCRIPT_FILENAME']);
$myFilePath = $thisDir . '/myfile.txt';
You can also use dirname(FILE) and if you've got magic quotes on the original version will have double backslashes in the path on a windows machine, don't know if Macs use forward or backslashes for paths, but just letting you know