public_html permissions with mod_php


I am running Virtualmin GPL with one virtual site. My site was running with FCGId but I had to change it to mod_php (running with apache user). After the change the website can no longer write to directories in public_html. Currently in Virtualmin the user and group of the virtual site are admin/admin:
Administration username admin
Administration group admin
The home directory including public_html are also set to admin/admin.
What is the right way to make directories writable to the website? Do I have to change the home/public_html directory permissions to apache/apache? If I change it with chown will Virtual min overwrite the change and revert to admin/admin?



Yeah, using mod_php does create a permissions issue. If Apache needs to create files and directories, you would have to tweak the permissions of the directory to allow the apache user to do so.

One way to solve that would be to change the directory to be owned by the group “apache”, and make it group writable.

You couldn’t make it owned by both the user and group apache, or else your Virtual Server owner would lose the ability to make changes to that directory.