I have to change the permissions of the htdocs directory in apache to a certain group and with certain read/write/execute.
htdocs
The directories need to have 775
I use something similar to the solution provided by Gordon:
chmod -R ug=rw,o=r,a+X /path/to/folder/
It should always set 775 for folders and 664 for files, even if the execute permission was previosly set for some file