I have a PHP script that takes some sensitive data, hashes it, and then compares it against hashes in a text file on the server. Both the text file containing hashes and the PHP script are located in the same folder.
The problem is that I want only the PHP file to be able to read that text file -- not everyone on the web. However, I tried:
chmod 444 filename.txt and that of course, gave everyone 'read' permissions on it -- even people on the web. Now anyone on the web can directly call that text file over my server. I tried '440' but that restricted access for the PHP file as well.
How can I make the text file readable to the local PHP script, but restrict access to it for 'everyone' on the web?