RE: [PHP] reading/writing flatfiles with simultaneous users?
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Tue, 26 Sep 2000 06:28:11 +0000 |
| Subject: | RE: [PHP] reading/writing flatfiles with simultaneous users? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17536@lists.php.net to get a copy of this message | ||
If its the same file, you'll be subject to file locking on the file.
Eg
If you open for read/write in the first script, the file will not be able to
be opened for write in the second script (within the fileopen/close
timeframe)
So in answer to your question, php will only let one instance of a script
open and read a flatfile in that scenario.
With a database and record locking (ie using postgress), you can avoid this
as you probably know.
Alternatively you could have a failover which would try to open the file
within a specified time, and exit gracefully if it couldn't.
flat files are ok for low volume scripts - ie a few requests every now and
then, but kind of flail a little when attacked with multiple requests a
second.
YMMV!
Loz.
-----Original Message-----
From: Craig Simons [mailto:csimons@cdwebstudios.com]
Sent: September 26, 2000 02:18 PM
To: php-general@lists.php.net
Subject: [PHP] reading/writing flatfiles with simultaneous users?
I have a script that takes in variables from the user (user name,
ipaddress, refering page, etc) and writes them to a file. This file is
later read by another script to produce various stats. My question is, does
php only let one instance of a script execution open and read a flatfile at
a time? Obviously a flatfile has severe design limitations compared to a
database, but can it be kept accurate enough with proper programming
methods?
- Craiger
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net