1) either place the password file outside of the web root (as in /home/username/passwords) or use the file name .htpasswd.
using the .htpasswd file as a password file would work because by default apache is setup to prevent users from downloading the file.
2) if you intend to add users yourself you 'll need to make the file readable by apache (chmod 744). otherwise, if your php script will add users make the file writeable to the user/group apache is running as. this typically means chmod 746. but this means that anyone else on your server can write to the file.
3) encrypt passwords in the text file using md5 or another one way password encryption method. when the user tries to login, take what they've typed and md5 it, then compare it against the text file.
but regardless of what you do, this method isn't very secure against other users who might be on your server. and security can get worse as you automate the process. consider using a database (which has an entirely new set of security).