I’m porting a web system from Windows to Linux. I’ve solved most of the small issues, but this one is getting to me. I’ve got a text file which PHP writes logging information to. At the moment, PHP fails to open the file, citing ‘permission denied’. As far as I’m aware:
- The directory and the file to be written have 770 permissions
- The directory and all the files below it are owned by the user ‘web’, and the group ‘web’
- Apache is being run by user ‘web’*
*I checked this by running:
ps aux | grep apache
Any ideas? I can’t figure this one out. I tested setting the directory and the file to 777 permissions, and I was able to write to file – obviously this isn’t a viable workaround, this file is internal to the system and shouldn’t be accessible externally.
First thing I would do is change to 777, as you said works, create a file and then look at the owner and group of the new file.