Re: File Writing / Reading Question
| From: | Marek Kilimajer | Date: | Tue, 15 Apr 2003 10:56:39 +0000 |
| Subject: | Re: File Writing / Reading Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143903@lists.php.net to get a copy of this message | ||
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