Mac OSX Apache Write Privileges [closed]

2019-03-31 08:21发布

So here is my problem. Its started when I discovered that I couldn't install plugins or themes in WordPress from the admin panel, it just kept asking for my connection info ( http://cl.ly/DLdH/o ).

I found a blog post which suggested changing the ownership of the wordpress folder to the Apache user, i.e. _www like so

sudo chown -R _www ./

That did, partially, fix the problem as I was able to install plugins and themes as well as writing to the directory through PHP which was all good but then I couldn't add/delete/edit any of the files in my text editor or even in Finder. It just keeps asking for my user password in order to process the action.

Changing the ownership back fixes the password issue but then I cant do any writing to the directory though PHP anymore.

Is there a way to allow me do both things at the same time?

EDIT:

I came across this cmd

sudo dscl . -append /Groups/_www GroupMembership [myUsername]

which added me i.e. my username to the group _www, then I executed

sudo chown -R _www .
sudo chgrp -R _www .

then it worked!

1条回答
我想做一个坏孩纸
2楼-- · 2019-03-31 08:50

Have the user own the files. Change the group to _www. Give write permission to group.

chown -R <username> .
chgrp -R _www .
chmod -R g+w .
查看更多
登录 后发表回答