File permissions with PHP
Posted: Wed May 23, 2007 3:49 am
I have created a directory as root and set it's permissions to 777. I copied files into that directory and now some of those directories need writing access by the PHP scripts which reside within the parent I created as root.
PHP is run as Apache module, so it's user 'www-data' on my Debian system.
The reason I set the original directory to 777 was because 'www-data' falls under 'other' or 'world' priveleges, correct?
Obviously giving any directory 777 isn't ideal, so how do I make it so that the PHP scripts can still write to the directories but they do not need world write access?
If the owner is 'root' to I change group to 'www-data'?
This is something which has plagued me forever while I try and fully understand *nix file permissions.
If you could elaborate on how and why, I would be grateful.
Cheers
PHP is run as Apache module, so it's user 'www-data' on my Debian system.
The reason I set the original directory to 777 was because 'www-data' falls under 'other' or 'world' priveleges, correct?
Obviously giving any directory 777 isn't ideal, so how do I make it so that the PHP scripts can still write to the directories but they do not need world write access?
If the owner is 'root' to I change group to 'www-data'?
This is something which has plagued me forever while I try and fully understand *nix file permissions.
If you could elaborate on how and why, I would be grateful.
Cheers