Linux Permissions


Hi,

I have been doing web development for linux and windows from 2 years now, and i have come across only developers that really knows the difference between the two operating system, Most of them says whats the difference between two Operating system, after all they get apache running on both.

The first difference is the way file permissions are implemented on two operating system. In this post I am only going to explain the File Permission required for PHP based website.

First, What is File Permission? Simple, as word suggest permission give to the person who access the file. Now, Second question, who is the person? Well it can be File owner (linux user) , Group Member (Please read Linux Users manual for this) or anybody else in this world.

Now Linux runs each service under one user and group. Now, the web server also runs as some user in the Linux Machine. This member is not the User and not the Group member of the group Site Owner generally is the member. So, we need to implement three Person ( User, Group, Everyone ) different permission.

What all permission we can set? For this the answer is simple
Read, Write , Execute…

Now, To set run a PHP File you simply need to give Read permission unless you are running a system commands through PHP, that is either a call to File open, or Using CURL, or running exec function you just need to give Read permission to all three. But than who can you modify your script. So you need Write permission,

Ahh, My group member should allow to modify the file… than you can give Write permission to him as well.

Now, I want it to be public script any one can edit…Than Please don’t read this post and simply run

chmod 777 myfile

Anyway’s In typical condition we need to give 644 Permisson to a PHP script unless it is using some above suggested request in that case we need to give 755 a permission.

Hope this is so some help in understanding the file permission on should give to run its PHP scripts…

More on this will be posted on my site soon, till than bye from me

Sumit Gupta