Posted by Jim at June 9th, 2004

Though I do know enough about PHP to put together a mildly complex registration form for a conference, I still have much to learn.

Right now I’m in the process of rewriting GRACE’s website such that anyone in the organization can change and edit text on the site. As a result, I have to learn how to allow PHP to edit files. The goal is to allow people the ability to edit only those parts of the document that I trust them with (text) and leave the rest alone.

This means that I’m in the process of investigating how PHP reads in and writes out files. Here’s one amusing thing I’ve learned: fopen (the command for opening/writing files) apparently does not lock. This means that if two people edit the same file and attempt to write the file at the same time, fopen will attempt to write both versions at once, creating a file full of utter gibberish.

So… it looks like I may have to write my own locking mechanism. That or allow only one person to edit files at a time.

Originally, I was going to let MoveableType handle this, but, the number of authors makes that more expensive than I think we want to bother with.