Are you trying to make your own site safe from exploits, or keep the file safe from prying eyes? If it's the former, then ixalmida's solution will work on a PHP5 enabled server.
If you're trying to keep the file safe from prying eyes, then I'd suggest a couple of things you could do. Put the file on it's own in a directory, which you can then secure with an .htaccess file (assuming you're using Linux).
Also, assuming that PHP is creating this file, give it 770 permissions, which should protect anonymous people from viewing it should the .htaccess password protection fail for any reason.