Re: Some advice on working with files
| From: | John Biesnecker | Date: | Tue, 27 Jun 2000 21:31:46 +0000 |
| Subject: | Re: Some advice on working with files | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3455@lists.php.net to get a copy of this message | ||
You can do advisory file locking using flock() in PHP but it only works if
just PHP is using it... true C offers more extensive locking functions...
I ended up doing a C script because I was using file() to load it into an
array, but I was using very large files and loading the entire file and
writing at the end was becoming resource intensive. If it's just a small
file, I'd recommend file() because it's easy.
----- Original Message -----
From: Billy Harvey <Billy.Harvey@thrillseeker.net>
To: John Biesnecker <amraam@ao.net>
Cc: <php-general@lists.php.net>
Sent: Tuesday, June 27, 2000 5:32 PM
Subject: Re: [PHP] Some advice on working with files
> John Biesnecker writes:
> > I dealt with the problem myself just recently (yesterday, in fact).
The
> > best solution I found was to write C scripts and execute them from PHP
> > (because C offers much more robust filehandling stuff) but, barring
that,
> > I'd read it all into an array and manipulate the individual lines...
> > otherwise modifying text files is a real pain.
>
> How would you handle file locking in PHP, or would this alone be a
> good enough reason to call an external program?
>
> Billy
>