php log file access

Posted on 2004-08-23
Last Modified: 2008-03-06
I would like to have a log file directory that I can read and write to, but I don't want people to be able to see the files from the web.  What do I have to do?
Question by:jackjohnson44
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 11874279
Hi jackjohnson44,

I would just use a directory that is unmapped on web server as log file directory.  Alternatively, you could always use .htaccess to control access or set passwords on directories to protect mapped directories.

LVL 55

Expert Comment

by:Jaime Olivares
ID: 11874286
Just use any directory of your server.
Your Web configuration can avoid any visitor to access your specific directory though a browser or ftp.

Author Comment

ID: 11882419
how do I configure this?

Is there something to do with the permissions?
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

LVL 55

Accepted Solution

Jaime Olivares earned 50 total points
ID: 11882505
Yes, almost any Web server has a "control panel" where you can configure some directories (or better all) to be read directly like Windows Explorer, then you can just access it though contained Web pages.

Expert Comment

ID: 11882541
let's say your personal web root is at /home/myname/public_html, then all you need to do is mkdir /home/log and have your php script read and write to files in that directory.  That newly created log directory is not even mapped on your web server and not under your web root, so no www user can view anything in it.

Expert Comment

ID: 11882564
sorry, I meant you can mkdir /home/myname/log, which is the directory that you'd have file system permission to create.

If you're on Windows machine, same thing.  Just create a new directory that is not under your web server root directory, and let php read and write to it.

Expert Comment

ID: 11892110
Note also that PHP has syslog() function that can write to the standard syslog files on Unix machines and to the Event log on Windows machines.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question