Musawir Ali - 2006-07-26

I've got a lot of emails from people asking about permission issues. Seems like a lot of users are confused, specially when it comes to unix servers. Unfortunately, setting proper permissions is critical to both getting the form generator to work as well as keeping your server secure. Therefore, the users must understand the different permission levels and set them up appropriately.

Firstly, I would like to explain what the different file modes mean. You must have seen people telling you to chmod your files or directories to 755 or 700 or 777, etc. But what do these numbers mean? Well, these numbers are called file modes in unix. They define the permission levels on particular files. The number if composed of three digits. The first digit (from left to right) defines the permission assigned to the owner of the file. The second digit defines the permission assigned to the group that the owner (or creator) of the file belongs to. The third digit defines the permission assigned to everyone else.
Each digit is actually a 3 bit binary number, example: 101. Each bit defines the "type" of permission. The first bit (from left to right) states if the file is readable (if equal to 1) or not (if equal to 0). The second bit states if the file is writeable, and the third bit states if the file is executable. So for example, the binary number 101 means that the file "is readable", "is not writeable", "is executable". Now if we convert this binary number to decimal (or base 10) form, it would be equal to 5. This digit is then assigned to the unix file mode discussed above.
One thing you might have noticed is that most of the unix file modes start with 7, for example as in 755. As mentioned earlier, the first digit defines the permission of the owner. We can convert the 7 to binary, which is equal to 111. From this, we determine that the owner has full read, write, and execute permissions. If we take the third digit that corresponds to the file permissions for everyone else and decipher it the same way, we get: 5 = 101, which means that everyone else can read and execute this file, but not write to it.

The file permissions and modes discussed above work the exact same way on directories. In fact directories (among other things) are files in a unix system, but lets not get into that. The important thing to note is that phpFormGenerator requires write permissions to certain directories. This is because since the program is "creating" new files for you, it must have proper permissions so it can write those files to your server's disk.