How to set permissions for apache
Hi there,
i'm running Fedora 25 and set up apache, mysql and php. It runs just fine. But I have some trouble to set the user permissions right. I want to use Fedora as my desktop environment and write and test php scripts on my local machine. Those scripts don't need to be accessible from the internet. Localhost only.
First i had some trouble to figure out what the problem actually was. But then I figured out that SELinux was blocking my script attempting to write to its own cache directory. I did the following to solve the problem:
sudo chown apache:apache -R /home/dave/www/html/mysite
find . -type f -exec chmod 0644 {} \;
find . -type d -exec chmod 0755 {} \;
sudo chcon -t httpd_sys_content_t /home/dave/www/html/mysite -R
sudo chcon -t httpd_sys_rw_content_t /home/dave/www/html/mysite/cache -R
According to the apache logs, it can now write to the cache folder just fine, but I don't have access to the directory at all. Which I understand because I chown it to apache. What, as a newbie, don't understand is, how I can give read and write access to my personal user and apache.
I read that i can add me to the apache group, as a subgroup. But that didn't work out (nothing changed). And when I do the command "groups" it only shows me "dave wheel". The command "users" shows me only "dave". So those functions don't show me an apache user or an apache group at all.
I'm pretty new to Linux and english is not my main language. So I just hope you understand what my problem is, what I want to archive and that my english is at least understandable.
Thanks for reading.
Welcome to ask.fedora. Have you logged out and back in since adding yourself to the apache group? I ask, because if memory serves, you need to do this for any changes to your list of groups to take effect.
sideburns ( 2017-06-18 00:45:41 +0000 )edit