[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

php log file access

Hello,
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?
0
jackjohnson44
Asked:
jackjohnson44
1 Solution
 
inq123Commented:
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.

Cheers!
0
 
Jaime OlivaresSoftware ArchitectCommented:
Just use any directory of your server.
Your Web configuration can avoid any visitor to access your specific directory though a browser or ftp.
0
 
jackjohnson44Author Commented:
how do I configure this?

Is there something to do with the permissions?
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
Jaime OlivaresSoftware ArchitectCommented:
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.
0
 
inq123Commented:
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.
0
 
inq123Commented:
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.
0
 
gnudiffCommented:
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.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now