The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Locking files within Apache
Brian Chandler
post Jan 25 2009, 02:38 AM
Post #1


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



I'm using pair.com hosting: FreeBSD / Apache / PHP / Mysql

I have a file included as part of a page (for reference, it's the "Website" section of the following page, basically a list of links to the manufacturer's site: http://imaginatorium.org/shop/appleone.htm -- it's also included in at least one other page).

Now I'm going to keep the catalog info in the database, and write out this from one of my admin pages. So I thought I ought to lock the file while I'm writing it, so (presumably?) the server would just wait if the file is in the process of being written. Thus it would not be possible to get a corrupt version if someone is loading the page while I'm writing it.

PHP has a file lock function flock(), but this would need the pages including the file to call flock() as well, which I don't want, since they do not need exclusive access for reading. I wonder if there is a "proper" way to do it? Or am I going over the top worrying about it?

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 04:53 AM