I have a php script where I use the function
mkdir()
but I getWarning: mkdir() [function.mkdir]: Permission denied
How can I grant a user permission to this function?
Apache/CentOS
Update
Here’s the permission for the folder I’m trying to create folders in:
drwxrwxrwx 2 rayhawkpascom pasgroup 4096 Sep 28 15:07 uploads
* both user and group are recursive.
And here’s the members of pasgroup
# grep pasgroup /etc/group pasgroup:x:562:rayhawkpascom,apache,nobody
* I tried www-data but
# /usr/sbin/usermod -G pasgroup www-data usermod: user www-data does not exist
To my knowledge, I’ve done everything right, but it still doesn’t work… =\
Answer
Since you are running this under apache, the apache user (usually www-data) needs write access to the directory it is attempting to run mkdir()
in. Either add www-data to the group that owns that directory or do chgrp www-data dir
to change the group ownership.
Attribution
Source : Link , Question Author : Steve Robbins , Answer Author : slillibri