Results 1 to 2 of 2
Hi. First off, let me say that im pretty new to linux and PHP programming. If you happen to respond, please dont use the most advanced language you can come ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-18-2006 #1
- Join Date
- Apr 2006
Reading system log from browser
First off, let me say that im pretty new to linux and PHP programming. If you happen to respond, please dont use the most advanced language you can come up with :=)
I want to make a PHP script that reads the system log, so that i can access it through my browser. I can read/print files with PHP and get them to show in the browser, but i need to use sudo in order to read the system log.
This is the script i use to read/print a log file that is just in the root dir: How do i "fix" it so it can read a file that the browser dont have rights to ?
<?php $fp = @fopen("log.txt", "rb") or die("Couldn't open the log");
$data = fread($fp, filesize($fp));
$data .= fgets($fp, 1024);
- 04-18-2006 #2
In short, you can't... thats the point of permissions....
You could use group permissions to just allow the server read permissions. But if you just want to view logs online, check out something like webmin. Or better, just have a cron job do it nightly.....