Re: File Writing / Reading Question
| From: | Marek Kilimajer | Date: | Tue, 15 Apr 2003 13:00:17 +0000 |
| Subject: | Re: File Writing / Reading Question | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143932@lists.php.net to get a copy of this message | ||
Hopefully you will not so many of them and remove them now and then. Then you can use file() function, it will read the file and return an array with one line in every array element. Then array_reverse() it.
Miguel Angelo wrote:
You must use a lock, see flock()Thankx i willtoPlus, do you have any advice on how to read the file from back to start,generatinggenerate a html file starting with the most recent messages, alsoNot 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 ?the html has fast has possibleA 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?Miguel Angelo wrote:newbieHi Everyone, First Thankxs reading. I'm starting to learn PHP (it's great by the way) and have a littleonquestion 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 lattertimea web page. The thing is does PHP use any file locking ? for example if at the sametothere 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,generatinggenerate a html file starting with the most recent messages, alsothe html has fast has possibleA 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