Reputation: 5777
I have two files which i want read using php. One file is located in /var/www/html
and the other file is located in /svn/access/
(directory which i have created). I can read the file which is in /var/www/html
but the other one cannot be read.
I get the following error message:
Warning: fopen(/svn/access/test): failed to open stream: Permission denied in /var/www/html/svnmanager/test2.php on line 5
I have given permission to all the directories and file using 'chmod' and 'chown'
chown -R apache:apache /svn*
chmod -R 755 /svn
chown -R apache:apache /svn/*
chmod -R 755 /svn/*
But i'm still getting that error, When i try to read from the path /svn/access
. Why is this happening and how can i fix this ? Please help!
Upvotes: 0
Views: 3234
Reputation: 5777
Finally found myself a solution for this.
SELinux blocks httpd to write in any folder other than /var/www/
. Therefore some configurations have to be made.
yum -y install policycoreutils-python
semanage fcontext -a -t httpd_sys_rw_content_t "/svn/access(/.*)?"
restorecon -R /svn/access
Upvotes: 1
Reputation: 3953
Always use 4 numbers, i had a lot of trouble because i forgot that. So 0755 would be my suggestion.
Upvotes: 0
Reputation: 2972
have you used sudo?
sudo chown -R apache:apache /svn*
sudo chmod -R 755 /svn
sudo chown -R apache:apache /svn/*
sudo chmod -R 755 /svn/*
you may need to be a super user to change permissions
Upvotes: 0