Enable apache to fopen/write in a directory?
Solution 1
Doh. I actually ended up doing..
- chmod -R meder:www-data BETA_sitename_com/ KEY
- chmod -R 770 BETA_sitename_com/
Does that look right? Any quirks? Seemed to work.
Solution 2
777 will definately get you write access to the file. To be properly secure however, you'd only want to make it 757 or 775 - whichever allows apache to write to the file.
Related videos on Youtube
meder omuraliev
I began learning front end web development around 04-05, started my first program around 06 with PHP. Currently, I am a Web technologist specializing in full stack development and linux administration specializing with the LAMP stack ( HTML5, CSS3, PHP, Apache, MySQL). I also like to dabble in node.js, meteorjs, Python, django and in general like to mess with new technology/stacks. LinkedIn | [email protected]
Updated on September 17, 2022Comments
-
meder omuraliev over 1 year
I just recently setup apache, I'm setting up a basic site and right now I'm having permissions issues. Firstly,
/www/ /www/sitename_com
are owned by meder:meder
and the permissions are 755 recursively ( or so I think ).
I setup a virtualhost, now in sitename_com there's a 'foo.php' and I'm trying to fopen ( create a new file ) within that directory.. it would be at
/www/sitename_com/en/file.xml
However Apache complains with:
Warning: fopen(en/file.xml) [function.fopen]: failed to open stream: Permission denied
www-user is Apache right? I need to give it permissions to my user group ( meder:meder .. not really a "group" )..
Thanks in advance.
-
random over 14 years755 is what most webhosts recommend/allow.