How Do I Give Apache The Rights Permissions


I do follow now a yii tutorial.

But as soon as I use Gii I see permission denied messages.

How do I give apache the right answers so I can carry on ?


Gii is going to generate some files and then write them files to the disk giving the system credentials used by the program running the web server in your case apache.

In case you are running on linux or any *nix variant, you can solve this problem by:

1 - changing the ownership of the folder that holds the files to be written

eg. $ sudo chown -R username:www-data /folder-path

given that user is the username of user that is going to edit the files, www-data is the group that apache runs under a default instalation and /folder-path is the location where the source code of you application is stored. This sets the owner as username and at the same time the group as www-data so that later on whe can give additional permissions to the members of this group.

2 - changing permissions of the same folder

eg. $ sudo chmod -R 775 /folder-path

this gives ful permission(read + write + execute) to the user and the www-data group.

read and execute to anybody else.

Now apache is able to write to the disk.

It has been a long time since I have used windows as a dev environment, but the principle of solving this problem still holds.

you can use chmod 775 filename