Php visitor logging

hey everybody. i am tracking visitors to my site using a php script. it puts visitor information (ip address, hostname, etc) into a .txt file.

right now i have created a directory in my directory to store the log files. the problem is that anybody who finds out the address can view these files and i want this information to be private.

is there any way to store the files somewhere that is not public? how would i specify the path to store the files in a private location?

I think this link should be of help:


You could password protect that directory or url as the poster above points out.

You could also create and write to the log file in a path that is above or outside of the area that apache makes available. For example /home/USER/mywebsiteslogs/logfile.txt

If you don’t want the files to be pulic accessable, don’t store the file in your domain directory /home/yourusername/ directory. That is public. Store the files in your user’s home directory /home/youruser

Storing it in the /home/yourusername area sounds like what I need. How would I find my username in the /home/username path? Is it the same name as the ftp login?[hr]
Never mind, I figured out the correct path. Quick question though. Is there any harm in changing the permissions of the /home/username/logs directory to 750 (that is, adding user write permission) and storing the logs there?

It seems like /home/username/logs/ is the best place to put the logs but there is a problem if I try to use that directory. Why?

The directories in /home/username/logs are reserved for the use of the web server. Put your own log files somewhere else.