Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from superuser.com Aug 15 '09 at 7:52

This question came from our site for computer enthusiasts and power users.

5 Answers 5

up vote 2 down vote accepted

Doh. I actually ended up doing..

  1. chmod -R meder:www-data BETA_sitename_com/ KEY
  2. chmod -R 770 BETA_sitename_com/

Does that look right? Any quirks? Seemed to work.

share|improve this answer

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.

share|improve this answer
    
755 is what most webhosts recommend/allow. –  random Aug 15 '09 at 0:31

One other idea you might consider is to use the apache 'user' configuration directive and run the apache website as the meder user. Files/directories could then be 644/755 permissions respectively.

share|improve this answer

Make dedicated VHost user for FTP file upload and with very limited privileges. Then set up apache to run vhost with user privileges either with suPHP or MPM-ITK.

share|improve this answer

If its a fopen command and php is involved you may check the php.ini

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.