Re: File Writing / Reading Question
| From: | Miguel Angelo | Date: | Tue, 15 Apr 2003 04:53:46 +0000 |
| Subject: | Re: File Writing / Reading Question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143931@lists.php.net to get a copy of this message | ||
> You must use a lock, see flock()
Thankx i will
> >Plus, do you have any advice on how to read the file from back to start,
to
> >generate a html file starting with the most recent messages, also
generating
> >the html has fast has possible
> >
> A bit too complicated, or if you take it simple and read the whole
> file into an array, it could eat all awailable memory. Why don't you
> use database to store the log entries?
Not really a good point, i want a log that keeps messages like... database
not available... so :) ..... no go
i'm using a database (mysql) but this file is just for very critical messages
can't i read a text file backwards ?
> Miguel Angelo wrote:
>
> >Hi Everyone,
> >
> > First Thankxs reading.
> >
> >
> >I'm starting to learn PHP (it's great by the way) and have a little
newbie
> >question which i search the online docs but failed to find...
> >
> >I want to write a error log file for any site errors, and read it latter
on
> >a web page.
> >
> >The thing is does PHP use any file locking ? for example if at the same
time
> >there is a attempt to write on the log file what appends ?
> >on Perl i had to lock the file, do i have to do this on PHP ? or is it a
> >automatic lock ?
> >
> You must use a lock, see flock()
>
> >
> >Plus, do you have any advice on how to read the file from back to start,
to
> >generate a html file starting with the most recent messages, also
generating
> >the html has fast has possible
> >
> A bit too complicated, or if you take it simple and read the whole
> file into an array, it could eat all awailable memory. Why don't you
> use database to store the log entries?
>
> >
> >all feedbacks are welcome.
> >
> >Stay well and happy
> >Miguel Angelo
> >
> >
> >
> >
> >
> >
> >
> >