I'm just starting my studies on servers and file system in order to program a couple of utilities with PHP.
I have Apache set up as my local host at OS X. Just to make sure which user Apache is running as, I ran posix_getpwuid(posix_getegid())['name']
and it returned the expected _www
. Then I went ahead and ran
$filename = '/Volumes/HDD/programming/PHP/sandbox/dir_permissions_tests/text.txt';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
At first I didn't want to create a separate group to add myself and Apache because I wanted to test how it would work if I added reading permission to "others". The output is also "The file does not exist". Then I added reading permission to all directories in the file path as pointed out at PHP can't read file with read permissions. Same problem. Then I added execution permissions as advised in the same link. No changes.
Am I wrong to presume that by having reading, writing and execution permissions set to all directories in the path and to the file itself for the "others" group PHP, by running under Apache _www
should be able to find it regardless of the file and group it belongs to (that's why I'm trying under 647)? What am I missing? Maybe my understanding of "others" as "everything else" is not correct. I didn't intend to change ownership of all directories in the path just to make it work. Creating a separate group is an option, though, but I'd like to understand the issue with "others" first.
Many thanks.