Re: Help parsing text file?
| From: | Brad Pauly | Date: | Thu, 08 Jan 2004 23:52:18 +0000 |
| Subject: | Re: Help parsing text file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174077@lists.php.net to get a copy of this message | ||
On Thu, 2004-01-08 at 16:27, Carlton L. Whitmore wrote:
> I'm very new to PHP.
> I want to display /var/log/lastlog with php on a webpage, but I need
> some help. How do I do that?
> Looking at the docs it looks like file() would work, but I couldn't get
> it to display the file.
I would guess that this is because the user that your web server is
running as (usually www or nobody or apache; you can find out by looking
in your httpd.conf file) does not have read access to that file.
Out of curiosity, why do you want to read that file? I would suggest
creating a cron job that runs the lastlog command and writes the results
to a file that is readable by the user that the web server is running
as. If you want the information to be more up to date, you could make
that user a 'sudoer' and run the lastlog command via shell_exec(). I
would be cautious about giving that kind of privileges though.
- Brad